]> granicus.if.org Git - postgresql/commit
Support ORDER BY within aggregate function calls, at long last providing a
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 15 Dec 2009 17:57:48 +0000 (17:57 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 15 Dec 2009 17:57:48 +0000 (17:57 +0000)
commit34d26872ed816b299eef2fa4240d55316697f42d
treed7373e29b365c151702c44325f0f5cc9dcc3e17c
parent6a6efb964092902bf53965649c3ed78b1868b37e
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
31 files changed:
doc/src/sgml/func.sgml
doc/src/sgml/syntax.sgml
src/backend/executor/nodeAgg.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/nodeFuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/readfuncs.c
src/backend/optimizer/plan/planagg.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/util/clauses.c
src/backend/parser/analyze.c
src/backend/parser/gram.y
src/backend/parser/parse_agg.c
src/backend/parser/parse_clause.c
src/backend/parser/parse_expr.c
src/backend/parser/parse_func.c
src/backend/parser/parse_utilcmd.c
src/backend/utils/adt/ruleutils.c
src/include/catalog/catversion.h
src/include/nodes/parsenodes.h
src/include/nodes/primnodes.h
src/include/optimizer/clauses.h
src/include/parser/parse_agg.h
src/include/parser/parse_clause.h
src/include/parser/parse_func.h
src/test/regress/expected/aggregates.out
src/test/regress/expected/create_aggregate.out
src/test/regress/output/misc.source
src/test/regress/sql/aggregates.sql
src/test/regress/sql/create_aggregate.sql