Re: Enhancement request: enable FIRST/LAST_value() also as a regular aggregate (not only as windowing function) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Enhancement request: enable FIRST/LAST_value() also as a regular aggregate (not only as windowing function)
Date
Msg-id 29473.1532629886@sss.pgh.pa.us
Whole thread Raw
In response to Re: Enhancement request: enable FIRST/LAST_value() also as a regularaggregate (not only as windowing function)  (matshyeq <matshyeq@gmail.com>)
Responses Re: Enhancement request: enable FIRST/LAST_value() also as a regularaggregate (not only as windowing function)
List pgsql-hackers
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)".

            regards, tom lane


pgsql-hackers by date:

Previous
From: matshyeq
Date:
Subject: Re: Enhancement request: enable FIRST/LAST_value() also as a regularaggregate (not only as windowing function)
Next
From: Vik Fearing
Date:
Subject: Re: Enhancement request: enable FIRST/LAST_value() also as a regularaggregate (not only as windowing function)