PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.
unnest allows for arrays to be "unnested" and expanded into a set of rows.
unnest
Conversely, array_agg can take the output of a set of rows and aggregate them into an array.
array_agg
For more information: