PostgreSQL is an amazing database, no surprises here. But every now and then I discover an amazing little feature that I was missing, this week was the time to discover
Suppose that you have two tables
student and want to list every student enrolled in a given discipline.
Usually I did this with a quick Python script by grouping the course and than using than making a simple
', '.join(). With the aggregate
string_agg function I now do it directly in the query.