]> granicus.if.org Git - postgresql/commit
Make the behavior of HAVING without GROUP BY conform to the SQL spec.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 Mar 2005 23:21:26 +0000 (23:21 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 10 Mar 2005 23:21:26 +0000 (23:21 +0000)
commit595ed2a8550e34c0abe64569a104d92ad077ec08
tree004764220f537256d96637d5a119fd2086ed40ec
parent609e32b929cf8684f8ae3a2b9f1655b372fb8b85
Make the behavior of HAVING without GROUP BY conform to the SQL spec.
Formerly, if such a clause contained no aggregate functions we mistakenly
treated it as equivalent to WHERE.  Per spec it must cause the query to
be treated as a grouped query of a single group, the same as appearance
of aggregate functions would do.  Also, the HAVING filter must execute
after aggregate function computation even if it itself contains no
aggregate functions.
20 files changed:
doc/src/sgml/query.sgml
doc/src/sgml/ref/select.sgml
src/backend/executor/nodeGroup.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/util/pathnode.c
src/backend/parser/analyze.c
src/backend/parser/parse_agg.c
src/backend/rewrite/rewriteHandler.c
src/backend/rewrite/rewriteManip.c
src/include/nodes/parsenodes.h
src/include/optimizer/planmain.h
src/include/rewrite/rewriteManip.h
src/test/regress/expected/select_having.out
src/test/regress/expected/select_having_1.out
src/test/regress/expected/select_having_2.out
src/test/regress/sql/select_having.sql