mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Fix using GroupBy/non-GroupBy expressions in HAVING.
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.13 1998/09/01 04:30:26 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.14 1998/09/09 03:48:17 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -104,7 +104,8 @@ exprIsAggOrGroupCol(Node *expr, List *groupClause)
|
||||
List *gl;
|
||||
|
||||
if (expr == NULL || IsA(expr, Const) ||
|
||||
IsA(expr, Param) ||IsA(expr, Aggreg))
|
||||
IsA(expr, Param) || IsA(expr, Aggreg) ||
|
||||
IsA(expr, SubLink)) /* can't handle currently !!! */
|
||||
return TRUE;
|
||||
|
||||
foreach(gl, groupClause)
|
||||
@ -207,13 +208,10 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
|
||||
* the expression specified in the HAVING clause has the same
|
||||
* restriction as those in the target list.
|
||||
*/
|
||||
/*
|
||||
* Need to change here when we get HAVING works. Currently
|
||||
* qry->havingQual is NULL. - vadim 04/05/97
|
||||
|
||||
if (!exprIsAggOrGroupCol(qry->havingQual, qry->groupClause))
|
||||
elog(ERROR,
|
||||
"parser: illegal use of aggregates or non-group column in HAVING clause");
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user