pgsql: Support ORDER BY within aggregate function calls, at long last

Lists: pgsql-committers
From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Support ORDER BY within aggregate function calls, at long last
Date: 2009-12-15 17:57:48
Message-ID: 20091215175748.91E92753FB7@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

Log Message:
-----------
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

Modified Files:
--------------
pgsql/doc/src/sgml:
func.sgml (r1.492 -> r1.493)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/func.sgml?r1=1.492&r2=1.493)
syntax.sgml (r1.138 -> r1.139)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/syntax.sgml?r1=1.138&r2=1.139)
pgsql/src/backend/executor:
nodeAgg.c (r1.169 -> r1.170)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeAgg.c?r1=1.169&r2=1.170)
pgsql/src/backend/nodes:
copyfuncs.c (r1.453 -> r1.454)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/copyfuncs.c?r1=1.453&r2=1.454)
equalfuncs.c (r1.375 -> r1.376)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/equalfuncs.c?r1=1.375&r2=1.376)
nodeFuncs.c (r1.43 -> r1.44)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/nodeFuncs.c?r1=1.43&r2=1.44)
outfuncs.c (r1.374 -> r1.375)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/outfuncs.c?r1=1.374&r2=1.375)
readfuncs.c (r1.227 -> r1.228)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/readfuncs.c?r1=1.227&r2=1.228)
pgsql/src/backend/optimizer/plan:
planagg.c (r1.46 -> r1.47)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/planagg.c?r1=1.46&r2=1.47)
planner.c (r1.261 -> r1.262)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/planner.c?r1=1.261&r2=1.262)
pgsql/src/backend/optimizer/util:
clauses.c (r1.280 -> r1.281)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/clauses.c?r1=1.280&r2=1.281)
pgsql/src/backend/parser:
analyze.c (r1.396 -> r1.397)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/analyze.c?r1=1.396&r2=1.397)
gram.y (r2.696 -> r2.697)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/gram.y?r1=2.696&r2=2.697)
parse_agg.c (r1.88 -> r1.89)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_agg.c?r1=1.88&r2=1.89)
parse_clause.c (r1.193 -> r1.194)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_clause.c?r1=1.193&r2=1.194)
parse_expr.c (r1.250 -> r1.251)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_expr.c?r1=1.250&r2=1.251)
parse_func.c (r1.218 -> r1.219)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_func.c?r1=1.218&r2=1.219)
parse_utilcmd.c (r2.31 -> r2.32)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_utilcmd.c?r1=2.31&r2=2.32)
pgsql/src/backend/utils/adt:
ruleutils.c (r1.316 -> r1.317)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/ruleutils.c?r1=1.316&r2=1.317)
pgsql/src/include/catalog:
catversion.h (r1.557 -> r1.558)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/catversion.h?r1=1.557&r2=1.558)
pgsql/src/include/nodes:
parsenodes.h (r1.418 -> r1.419)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/parsenodes.h?r1=1.418&r2=1.419)
primnodes.h (r1.151 -> r1.152)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/primnodes.h?r1=1.151&r2=1.152)
pgsql/src/include/optimizer:
clauses.h (r1.98 -> r1.99)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/clauses.h?r1=1.98&r2=1.99)
pgsql/src/include/parser:
parse_agg.h (r1.39 -> r1.40)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/parser/parse_agg.h?r1=1.39&r2=1.40)
parse_clause.h (r1.56 -> r1.57)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/parser/parse_clause.h?r1=1.56&r2=1.57)
parse_func.h (r1.66 -> r1.67)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/parser/parse_func.h?r1=1.66&r2=1.67)
pgsql/src/test/regress/expected:
aggregates.out (r1.19 -> r1.20)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/aggregates.out?r1=1.19&r2=1.20)
create_aggregate.out (r1.6 -> r1.7)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/create_aggregate.out?r1=1.6&r2=1.7)
pgsql/src/test/regress/output:
misc.source (r1.47 -> r1.48)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/output/misc.source?r1=1.47&r2=1.48)
pgsql/src/test/regress/sql:
aggregates.sql (r1.15 -> r1.16)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/aggregates.sql?r1=1.15&r2=1.16)
create_aggregate.sql (r1.7 -> r1.8)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/create_aggregate.sql?r1=1.7&r2=1.8)