mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +03:00
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.
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.235 2005/01/27 03:17:45 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.236 2005/03/10 23:21:21 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -661,14 +661,10 @@ _equalQuery(Query *a, Query *b)
|
||||
COMPARE_NODE_FIELD(limitCount);
|
||||
COMPARE_NODE_FIELD(setOperations);
|
||||
COMPARE_NODE_FIELD(resultRelations);
|
||||
COMPARE_NODE_FIELD(in_info_list);
|
||||
COMPARE_SCALAR_FIELD(hasJoinRTEs);
|
||||
|
||||
/*
|
||||
* We do not check the other planner internal fields: base_rel_list,
|
||||
* other_rel_list, join_rel_list, equi_key_list, query_pathkeys. They
|
||||
* might not be set yet, and in any case they should be derivable from
|
||||
* the other fields.
|
||||
* We do not check the planner-internal fields. They might not be set
|
||||
* yet, and in any case they should be derivable from the other fields.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user