From 595ed2a8550e34c0abe64569a104d92ad077ec08 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 10 Mar 2005 23:21:26 +0000 Subject: 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. --- src/include/optimizer/planmain.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/include/optimizer') diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h index 5a7dfa55fe5..e76d55ea496 100644 --- a/src/include/optimizer/planmain.h +++ b/src/include/optimizer/planmain.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.79 2004/12/31 22:03:36 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.80 2005/03/10 23:21:25 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -39,7 +39,7 @@ extern Agg *make_agg(Query *root, List *tlist, List *qual, int numGroupCols, AttrNumber *grpColIdx, long numGroups, int numAggs, Plan *lefttree); -extern Group *make_group(Query *root, List *tlist, +extern Group *make_group(Query *root, List *tlist, List *qual, int numGroupCols, AttrNumber *grpColIdx, double numGroups, Plan *lefttree); -- cgit v1.2.3