diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-03-08 01:49:01 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-03-08 01:49:01 +0000 |
commit | d73e9df087b87c4b959b4020084e543a54f7895b (patch) | |
tree | 4cbeafdfb86537142727bf959f9d81e0d04ae4bc /src/backend | |
parent | 572fda27118f7e54c7e4ebb75b48d33896e5f776 (diff) | |
download | postgresql-d73e9df087b87c4b959b4020084e543a54f7895b.tar.gz postgresql-d73e9df087b87c4b959b4020084e543a54f7895b.zip |
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...
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/optimizer/util/clauses.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index e6d51b047cc..bc05908148b 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.81 2001/02/12 18:46:40 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.82 2001/03/08 01:49:01 tgl Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -543,6 +543,14 @@ check_subplans_for_ungrouped_vars_walker(Node *node, return false; /* + * If we find an aggregate function, do not recurse into its + * arguments. Subplans invoked within aggregate calls are allowed + * to receive ungrouped variables. + */ + if (IsA(node, Aggref)) + return false; + + /* * We can ignore Vars other than in subplan args lists, since the * parser already checked 'em. */ |