PostgreSQL UNNEST Function

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PostgreSQL UNNEST() function

UNNEST() function

This function is used to expand an array to a set of rows.

Syntax :

unnest(anyarray)

Return Type :

setof anyelement

PostgreSQL Version : 9.3

Example : PostgreSQL STRING_TO_ARRAY() function

SELECT unnest(ARRAY[1,2]);

Output :

 unnest
--------
      1
      2
(2 rows)