You can use unnest() to unwrap an array into a set of rows.
For example, you can unwrap the array of INT[] type into a set of rows as shown below:
postgres=# SELECT unnest(ARRAY[1,2,3]::INT[]);
unnest
--------
1
2
3
(3 rows)
*Memos:
The type of unwrapped values are INT(INTEGER).
You can omit ::INT[], then the type of unwrapped values are still INT(INTEGER).
And, you can unwrap the array of VARCHAR[] type into a set of rows as shown below:
postgres=# SELECT unnest(ARRAY['John','David','Robert']::VARCHAR[]);
unnest
--------
John
David
Robert
(3 rows)
*Memos:
The type of unwrapped values are VARCHAR(CHARACTER VARYING).
You can omit ::VARCHAR[], then the type of unwrapped values are TEXT.
And, you can unwrap the array of RECORD[] type into a set of rows as shown below:
postgres=# SELECT unnest(ARRAY[ROW('John','Smith'),ROW('David','Miller')]);
unnest
----------------
(John,Smith)
(David,Miller)
(2 rows)
*Memos: