Search code examples
oracle-databasepostgresqlaggregate-functionspostgresql-9.2

ORACLE wm_concat equivalent in PostgreSQL


I'm new to PostgreSQL and I have a problem migrating databases from Oracle to PostgreSQL 9.2. I must change some native queries in my code. I have a subquery like:

SELECT wm_concat(p.first_name || ' ' || p.last_name) 
FROM TODO_PERSON PR 
JOIN PERSON P ON (p.id == pr.person_id)
WHERE todo_id = internal_table.id

In PostgreSQL I can't find equivalent function or other solutions ...


Solution

  • PostgreSQL has a bunch of available aggregation functions.

    wm_concat equivalent seems to be string_agg, except you must specify the delimiter. Please, check the documentation for details.