PostgreSQL 18 reference · String Functions

PostgreSQL CONCAT() Function

Join any number of values into one string, treating NULL arguments as empty strings.

PostgreSQL 18 Since 9.1

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

Syntax

concat(val1, val2, ...)

Parameters

ParameterDescription
val Values of any type.

Return value

Text (never NULL).

Examples

Join values
SELECT concat('Order #', order_id, ' - ', status) AS label
FROM orders
LIMIT 2;

Output

        label
----------------------
 Order #1 - delivered
 Order #2 - delivered
(2 rows)

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

NULLs are skipped
SELECT concat('a', NULL, 'b', 42) AS result;

Output

 result
--------
 ab42
(1 row)

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

Version history

VersionChange
PostgreSQL 9.1Added

In other languages

Was this page helpful?