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

Commit 76d5f6f

Browse files
committed
expression_tree_walker failed to let walker function see the immediate child
node of a SubLink or SubPlan testexpr field. Bug resulted from replacing the old lefthand/exprs list fields with a simple expression field, and not remembering that expression_tree_walker is coded to save a few cycles by recursing directly to self on list fields (on the assumption the walker isn't interested in List nodes per se). On non-list fields it must of course call the walker. Possibly that hack isn't worth the risk of more such bugs, but I'll leave it be for now. Per bug report from James Robinson.
1 parent 4df8de7 commit 76d5f6f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/backend/optimizer/util/clauses.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.222 2006/10/04 00:29:55 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.223 2006/10/25 22:11:32 tgl Exp $
1212
*
1313
* HISTORY
1414
* AUTHOR DATE MAJOR EVENT
@@ -3177,6 +3177,7 @@ expression_tree_walker(Node *node,
31773177
{
31783178
Aggref *expr = (Aggref *) node;
31793179

3180+
/* recurse directly on List */
31803181
if (expression_tree_walker((Node *) expr->args,
31813182
walker, context))
31823183
return true;
@@ -3249,8 +3250,7 @@ expression_tree_walker(Node *node,
32493250
{
32503251
SubLink *sublink = (SubLink *) node;
32513252

3252-
if (expression_tree_walker(sublink->testexpr,
3253-
walker, context))
3253+
if (walker(sublink->testexpr, context))
32543254
return true;
32553255

32563256
/*
@@ -3265,8 +3265,7 @@ expression_tree_walker(Node *node,
32653265
SubPlan *subplan = (SubPlan *) node;
32663266

32673267
/* recurse into the testexpr, but not into the Plan */
3268-
if (expression_tree_walker(subplan->testexpr,
3269-
walker, context))
3268+
if (walker(subplan->testexpr, context))
32703269
return true;
32713270
/* also examine args list */
32723271
if (expression_tree_walker((Node *) subplan->args,

0 commit comments

Comments
 (0)