mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Support ORDER BY within aggregate function calls, at long last providing a
non-kluge method for controlling the order in which values are fed to an aggregate function. At the same time eliminate the old implementation restriction that DISTINCT was only supported for single-argument aggregates. Possibly release-notable behavioral change: formerly, agg(DISTINCT x) dropped null values of x unconditionally. Now, it does so only if the agg transition function is strict; otherwise nulls are treated as DISTINCT normally would, ie, you get one copy. Andrew Gierth, reviewed by Hitoshi Harada
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.453 2009/12/07 05:22:22 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.454 2009/12/15 17:57:46 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1023,9 +1023,10 @@ _copyAggref(Aggref *from)
|
||||
COPY_SCALAR_FIELD(aggfnoid);
|
||||
COPY_SCALAR_FIELD(aggtype);
|
||||
COPY_NODE_FIELD(args);
|
||||
COPY_SCALAR_FIELD(agglevelsup);
|
||||
COPY_NODE_FIELD(aggorder);
|
||||
COPY_NODE_FIELD(aggdistinct);
|
||||
COPY_SCALAR_FIELD(aggstar);
|
||||
COPY_SCALAR_FIELD(aggdistinct);
|
||||
COPY_SCALAR_FIELD(agglevelsup);
|
||||
COPY_LOCATION_FIELD(location);
|
||||
|
||||
return newnode;
|
||||
@ -1968,6 +1969,7 @@ _copyFuncCall(FuncCall *from)
|
||||
|
||||
COPY_NODE_FIELD(funcname);
|
||||
COPY_NODE_FIELD(args);
|
||||
COPY_NODE_FIELD(agg_order);
|
||||
COPY_SCALAR_FIELD(agg_star);
|
||||
COPY_SCALAR_FIELD(agg_distinct);
|
||||
COPY_SCALAR_FIELD(func_variadic);
|
||||
|
Reference in New Issue
Block a user