Re: [HACKERS] Proposal/design feedback needed: WITHIN GROUP (sql standard ordered set aggregate functions)

2013-07-23 Thread Andrew Gierth
Noah Misch said: > Other aggregates based on this syntax might not desire such type unification. Then there would have to be some way to distinguish that. Maybe those could have -1 and the standard hypothetical set functions -2, with some flag in CREATE AGGREGATE to sort it out. > Having parse an

Re: [HACKERS] Proposal/design feedback needed: WITHIN GROUP (sql standard ordered set aggregate functions)

2013-07-22 Thread Andrew Gierth
Ok, since Atri posted our work-so-far and there's not been much comment, I'll outline here my proposed plan of attack. Rather than, as in the WIP patch, using the agg finalfn to validate the split between normal args and ORDER BY args, I propose this: Firstly, as in the WIP patch, func(a) with

Re: [HACKERS] Proposal/design feedback needed: WITHIN GROUP (sql standard ordered set aggregate functions)

2013-07-18 Thread Andrew Gierth
Josh Berkus wrote: > Hah, I didn't realize that our ordered aggregate syntax even *was* spec. The spec defines agg(x order by y) only for array_agg and xmlagg; the generalization to arbitrary other aggregates is our extension. (But kind of obvious really.) > > Our implementation does heavily reus

Re: [HACKERS] Proposal/design feedback needed: WITHIN GROUP (sql standard ordered set aggregate functions)

2013-07-18 Thread Andrew Gierth
Josh Berkus wrote: > On 07/17/2013 08:15 PM, Andrew Gierth wrote: > > The spec defines two types of aggregate function classed as "ordered set > > function", as follows: > > > > 1. An "inverse distribution function" taking one argument (which must be > >a grouped column or otherwise constant

Re: [HACKERS] Proposal/design feedback needed: WITHIN GROUP (sql standard ordered set aggregate functions)

2013-07-18 Thread Josh Berkus
On 07/17/2013 08:15 PM, Andrew Gierth wrote: > The spec defines two types of aggregate function classed as "ordered set > function", as follows: > > 1. An "inverse distribution function" taking one argument (which must be >a grouped column or otherwise constant within groups) plus a sorted >

[HACKERS] Proposal/design feedback needed: WITHIN GROUP (sql standard ordered set aggregate functions)

2013-07-17 Thread Andrew Gierth
The spec defines two types of aggregate function classed as "ordered set function", as follows: 1. An "inverse distribution function" taking one argument (which must be a grouped column or otherwise constant within groups) plus a sorted group with exactly one column: =# SELECT (func(p)