How to obtain a coalesce aggregation in a GROUP BY query?

Поиск
Список
Период
Сортировка
От Federico Dal Maso
Тема How to obtain a coalesce aggregation in a GROUP BY query?
Дата
Msg-id CAHf9ormkYtYwfv4V7=bzLL=Z-m0Unz4-_tDxbC806pEO5kp2Aw@mail.gmail.com
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Ty Busby
Дата:
Сообщение: optimize self-join query
Следующее
От: Brent Dombrowski
Дата:
Сообщение: Re: how to use explain analyze