Re: Enhancement request: enable FIRST/LAST_value() also as a regularaggregate (not only as windowing function)

Поиск
Список
Период
Сортировка
От Vik Fearing
Тема Re: Enhancement request: enable FIRST/LAST_value() also as a regularaggregate (not only as windowing function)
Дата
Msg-id 5503452e-bd22-8ea5-d874-32c3b05250d7@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: Enhancement request: enable FIRST/LAST_value() also as a regular aggregate (not only as windowing function)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 26/07/18 20:31, Tom Lane wrote:
> matshyeq <matshyeq@gmail.com> writes:
>> Can I make custom aggregate function that accepts WITHIN GROUP syntax?
> 
> It's possible, but it would have to be written in C, I think; see
> src/backend/utils/adt/orderedsetaggs.c for prototype code.  You'll
> find it a lot easier to write a plain aggregate function and control
> its input ordering with "last(foo order by foo)".

We have examples on the wiki.
https://wiki.postgresql.org/wiki/First/last_(aggregate)
-- 
Vik Fearing                                          +33 6 46 75 15 36
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Enhancement request: enable FIRST/LAST_value() also as a regular aggregate (not only as windowing function)
Следующее
От: Robert Haas
Дата:
Сообщение: Re: 11beta crash/assert caused by parameter type changes