How to obtain a coalesce aggregation in a GROUP BY query? - Mailing list pgsql-sql

From Federico Dal Maso
Subject How to obtain a coalesce aggregation in a GROUP BY query?
Date
Msg-id CAHf9ormkYtYwfv4V7=bzLL=Z-m0Unz4-_tDxbC806pEO5kp2Aw@mail.gmail.com
Whole thread Raw
List pgsql-sql
I need write a query like this

select coalesce_agg(col order by col asc) from some_table group by other_col

clearly the col column is nullable.
which is the best way (in terms of performance too) to obtain this?

Are there any built-in aggregate function or should I write a new aggregate function with CREATE AGGREGATE?
Do you think coalesce_agg should be a built-in aggregation?

Thanks in advance

--
Federico Dal Maso

pgsql-sql by date:

Previous
From: Ty Busby
Date:
Subject: optimize self-join query
Next
From: Brent Dombrowski
Date:
Subject: Re: how to use explain analyze