Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d73e9df

Browse files
committed
A subplan invoked within an aggregate function's argument should
be allowed to receive ungrouped variables of the current query level. Curious that no one reported this bug before...
1 parent 572fda2 commit d73e9df

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/backend/optimizer/util/clauses.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.81 2001/02/12 18:46:40 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.82 2001/03/08 01:49:01 tgl Exp $
1212
*
1313
* HISTORY
1414
* AUTHOR DATE MAJOR EVENT
@@ -542,6 +542,14 @@ check_subplans_for_ungrouped_vars_walker(Node *node,
542542
if (node == NULL)
543543
return false;
544544

545+
/*
546+
* If we find an aggregate function, do not recurse into its
547+
* arguments. Subplans invoked within aggregate calls are allowed
548+
* to receive ungrouped variables.
549+
*/
550+
if (IsA(node, Aggref))
551+
return false;
552+
545553
/*
546554
* We can ignore Vars other than in subplan args lists, since the
547555
* parser already checked 'em.

0 commit comments

Comments
 (0)