Tom Lane wrote:
> A larger objection to Jeff's draft patch is that it doesn't implement
> the <sort specification list>. I'm entirely happy about not doing that
> --- the current SQL committee's willingness to invent random new syntax
> and nonorthogonal behavior for every function they can think of will be
> the death of SQL yet --- but it's something that we at least need to
> document the workaround for.
How else will you tell an aggregate function whose result depends on the
input order which order you want? The only aggregates defined in the
standard where this matters are array_agg, array_accum, and xmlagg, but
it would also be useful in other cases such as a text concatenation
aggregate function or an aggregate function to calculate the correlation
(or whatever alternative metric we come up with). Given that the
standard does not provide for user-defined aggregates, I think the way
it's specified is perfectly OK.
Without a way to control the order, how useful are these array
aggregates really?