diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-12-15 17:57:48 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-12-15 17:57:48 +0000 |
commit | 34d26872ed816b299eef2fa4240d55316697f42d (patch) | |
tree | d7373e29b365c151702c44325f0f5cc9dcc3e17c /src/backend/parser/parse_expr.c | |
parent | 6a6efb964092902bf53965649c3ed78b1868b37e (diff) | |
download | postgresql-34d26872ed816b299eef2fa4240d55316697f42d.tar.gz postgresql-34d26872ed816b299eef2fa4240d55316697f42d.zip |
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
Diffstat (limited to 'src/backend/parser/parse_expr.c')
-rw-r--r-- | src/backend/parser/parse_expr.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index 8513102a9c3..7dc20b4d6a7 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -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, |