Denormalizing via SQL - Mailing list pgsql-general

From Robert James
Subject Denormalizing via SQL
Date
Msg-id CAGYyBghoDxsuLFQOCpbyFYaw_rz0aD5+aPCvRTr=C+xG18izjw@mail.gmail.com
Whole thread Raw
Responses Re: Denormalizing via SQL
List pgsql-general
I have a query returning:

name | product_id
Bob | 1
Bob | 2
Charles | 1
Charles | 4

To make it compatible with a legacy app, I need to convert it to this form:
name | product_ids
Bob | "1,2"
Charles | "1,4"

(Before you jump "That's not normal!" - I know.  I didn't write the
app.  I just need to meet its interface.)

What's the best way to do this in Postgres? Is there a way to do it
via pure SQL?

pgsql-general by date:

Previous
From: Eduardo Morras
Date:
Subject: Re: Hope for a new PostgreSQL era?
Next
From: Stefan Keller
Date:
Subject: Howto to clear PostgreSQL cache and how to preload all tuples of a table into the cache?