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

2018-07-26 Thread Tom Lane
matshyeq 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

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

2018-07-26 Thread matshyeq
Thanks Robert! I thought this could be nice functionality available out of the box but yea, sure, that would work for me. Can I make custom aggregate function that accepts WITHIN GROUP syntax? Which language would that need to be implemented in? Would you have examples (url?) Thank you, Kind

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

2018-07-26 Thread Robert Haas
On Tue, Jul 24, 2018 at 4:16 PM, matshyeq wrote: > I'd like to throw here an enhancement proposal to discuss/consider. > The FIRST/LAST_value() > > functions offer powerful lookup capabilities, eg. >

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

2018-07-24 Thread matshyeq
I was hoping the proposal would be judged on its merits - primarily usefulness, not necessarily conforming to the standards I would expect postgres overlap with the SQL standard (eg. SQL:2016) doesn't differ much from other big vendors and has lots of own deviations/extensions itself. Not a fan of

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

2018-07-24 Thread Tom Lane
matshyeq writes: > I'd like to throw here an enhancement proposal to discuss/consider. > The FIRST/LAST_value() > functions offer powerful lookup capabilities, ... > but, given those values are repeating - why can't I simply use this > functions as regular aggregates? > Or can I? It doesn't seem

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

2018-07-24 Thread matshyeq
Hi All, I'd like to throw here an enhancement proposal to discuss/consider. The FIRST/LAST_value() functions offer powerful lookup capabilities, eg. here 1)