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.
This commit is contained in:
Tom Lane 2006-10-25 22:11:32 +00:00
parent 4df8de7a68
commit 76d5f6f035
1 changed files with 4 additions and 5 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.222 2006/10/04 00:29:55 momjian Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.223 2006/10/25 22:11:32 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -3177,6 +3177,7 @@ expression_tree_walker(Node *node,
{
Aggref *expr = (Aggref *) node;
/* recurse directly on List */
if (expression_tree_walker((Node *) expr->args,
walker, context))
return true;
@ -3249,8 +3250,7 @@ expression_tree_walker(Node *node,
{
SubLink *sublink = (SubLink *) node;
if (expression_tree_walker(sublink->testexpr,
walker, context))
if (walker(sublink->testexpr, context))
return true;
/*
@ -3265,8 +3265,7 @@ expression_tree_walker(Node *node,
SubPlan *subplan = (SubPlan *) node;
/* recurse into the testexpr, but not into the Plan */
if (expression_tree_walker(subplan->testexpr,
walker, context))
if (walker(subplan->testexpr, context))
return true;
/* also examine args list */
if (expression_tree_walker((Node *) subplan->args,