ARRAY_APPEND (|| operator)
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
The ARRAY_APPEND
function allows for concatenating an element to the end of an array (see also ARRAY_PREPEND and ARRAY_CONCAT):
SELECT ARRAY[1, 2] || 3
create.select(arrayAppend(array(1, 2), 3)).fetch();
The result would look like this:
+--------------+ | array_append | +--------------+ | [1, 2, 3] | +--------------+
Dialect support
This example using jOOQ:
arrayAppend(array(1, 2), 3)
Translates to the following dialect specific expressions:
Aurora Postgres, CockroachDB, DuckDB, Postgres, YugabyteDB
array_append( ARRAY[1, 2], 3 )
BigQuery, H2, HSQLDB, Trino
(ARRAY[1, 2] || ARRAY[3])
ClickHouse
arrayPushBack( ARRAY(1, 2), 3 )
ASE, Access, Aurora MySQL, DB2, Derby, Exasol, Firebird, Hana, Informix, MariaDB, MemSQL, MySQL, Oracle, Redshift, SQLDataWarehouse, SQLServer, SQLite, Snowflake, Sybase, Teradata, Vertica
/* UNSUPPORTED */
Generated with jOOQ 3.20. Translate your own SQL on our website
Feedback
Do you have any feedback about this page? We'd love to hear it!