From: Tom Lane Date: Wed, 25 Oct 2006 22:11:32 +0000 (+0000) Subject: expression_tree_walker failed to let walker function see the immediate child X-Git-Tag: REL8_2_BETA3~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76d5f6f0355e3e4b448a9e4e8a393672f4730ac7;p=postgresql 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. --- diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index c9d9512b2f..3800228398 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -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,