mirror of
https://github.com/postgres/postgres.git
synced 2025-06-19 04:21:08 +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:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.250 2009/11/13 19:48:20 heikki Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.251 2009/12/15 17:57:47 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -431,7 +431,7 @@ transformIndirection(ParseState *pstate, Node *basenode, List *indirection)
|
||||
newresult = ParseFuncOrColumn(pstate,
|
||||
list_make1(n),
|
||||
list_make1(result),
|
||||
false, false, false,
|
||||
NIL, false, false, false,
|
||||
NULL, true, location);
|
||||
if (newresult == NULL)
|
||||
unknown_attribute(pstate, result, strVal(n), location);
|
||||
@ -598,7 +598,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
||||
node = ParseFuncOrColumn(pstate,
|
||||
list_make1(makeString(colname)),
|
||||
list_make1(node),
|
||||
false, false, false,
|
||||
NIL, false, false, false,
|
||||
NULL, true, cref->location);
|
||||
}
|
||||
break;
|
||||
@ -643,7 +643,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
||||
node = ParseFuncOrColumn(pstate,
|
||||
list_make1(makeString(colname)),
|
||||
list_make1(node),
|
||||
false, false, false,
|
||||
NIL, false, false, false,
|
||||
NULL, true, cref->location);
|
||||
}
|
||||
break;
|
||||
@ -701,7 +701,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
|
||||
node = ParseFuncOrColumn(pstate,
|
||||
list_make1(makeString(colname)),
|
||||
list_make1(node),
|
||||
false, false, false,
|
||||
NIL, false, false, false,
|
||||
NULL, true, cref->location);
|
||||
}
|
||||
break;
|
||||
@ -1221,6 +1221,7 @@ transformFuncCall(ParseState *pstate, FuncCall *fn)
|
||||
return ParseFuncOrColumn(pstate,
|
||||
fn->funcname,
|
||||
targs,
|
||||
fn->agg_order,
|
||||
fn->agg_star,
|
||||
fn->agg_distinct,
|
||||
fn->func_variadic,
|
||||
|
Reference in New Issue
Block a user