PostgreSQL 18 reference · Array Functions

PostgreSQL ARRAY_CAT() Function

Concatenate two arrays of the same element type into one new array. The || operator does the same thing.

PostgreSQL 18

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

array_cat(array1, array2)

Parameters

ParameterDescription
array1, array2 Arrays of the same element type.

Return value

A new array.

Examples

Join arrays
SELECT array_cat(ARRAY[1, 2], ARRAY[3, 4]) AS joined;

Output

  joined
-----------
 {1,2,3,4}
(1 row)

Run this on your computer — see “Get Started” for setup.

Two-dimensional arrays
SELECT array_cat(ARRAY[[1, 2]], ARRAY[[3, 4]]) AS two_rows;

Output

   two_rows
---------------
 {{1,2},{3,4}}
(1 row)

Run this on your computer — see “Get Started” for setup.

Was this page helpful?