Re: array_agg and array_accum (patch) - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: array_agg and array_accum (patch)
Date
Msg-id 4905F0B6.4070505@gmx.net
Whole thread Raw
In response to Re: array_agg and array_accum (patch)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: array_agg and array_accum (patch)
Re: array_agg and array_accum (patch)
List pgsql-hackers
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?


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ERRORDATA_STACK_SIZE exceeded (server crash)
Next
From: "Pavel Stehule"
Date:
Subject: Re: WIP: default values for function parameters