array_concat() function

The array_concat() function concatenates two arrays, creating an array that contains all the elements in the first array followed by all the elements in the second array.

The two arrays must be of the same type, and element names cannot be the same.

Syntax

The array_concat() function has the following syntax:
array = array_concat(array array1, array array2);

The array1 value specifies the first of the two arrays to concatenate.

The array2 value specifies the second of the two arrays to concatenate.

Returns

The function concatenates the two arrays.

Example

The following query concatenates two arrays and returns a new array of the same type:
select (array_concat (array(2),array(2))); 
 array_concat
--------------
 ARR
(1 row)