ARRAY PREPEND Function

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

PostgreSQL ARRAY_PREPEND() function

ARRAY_PREPEND() function

This function is used to append an element to the beginning of an array.

Syntax :

array_prepend (anyelement, anyarray)

Return Type :

anyarray

PostgreSQL Version : 9.3

Example : PostgreSQL ARRAY_PREPEND() function

SELECT array_prepend(1, ARRAY[2,3]);

Output :

 array_prepend
---------------
 {1,2,3}
(1 row)