w3resource
MySQL Tutorial

PostgreSQL ARRAY_TO_STRING() function

ARRAY_TO_STRING() function

This function is used to concatenate array elements using supplied delimiter and optional null string.

Syntax:

array_to_string(anyarray, text [, text])

Return Type:

text

PostgreSQL Version: 9.3

Example: PostgreSQL ARRAY_TO_STRING() function

Code:

SELECT array_to_string(ARRAY[1, 2, 3, NULL, 5], ',', '*');

Sample Output:

 array_to_string
-----------------
 1,2,3,*,5
(1 row)

Previous: ARRAY_REPLACE function
Next: ARRAY_UPPER function