mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
Fix parse_agg.c to detect ungrouped Vars in sub-SELECTs; remove code
that used to do it in planner. That was an ancient kluge that was never satisfactory; errors should be detected at parse time when possible. But at the time we didn't have the support mechanism (expression_tree_walker et al) to make it convenient to do in the parser.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.139 2003/01/15 19:35:40 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.140 2003/01/17 03:25:03 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -208,17 +208,6 @@ subquery_planner(Query *parse, double tuple_fraction)
|
||||
/* These are not targetlist items, but close enough... */
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for ungrouped variables passed to subplans in targetlist and
|
||||
* HAVING clause (but not in WHERE or JOIN/ON clauses, since those are
|
||||
* evaluated before grouping). We can't do this any earlier because
|
||||
* we must use the preprocessed targetlist for comparisons of grouped
|
||||
* expressions.
|
||||
*/
|
||||
if (parse->hasSubLinks &&
|
||||
(parse->groupClause != NIL || parse->hasAggs))
|
||||
check_subplans_for_ungrouped_vars(parse);
|
||||
|
||||
/*
|
||||
* A HAVING clause without aggregates is equivalent to a WHERE clause
|
||||
* (except it can only refer to grouped fields). Transfer any
|
||||
|
Reference in New Issue
Block a user