From 31468d05d89d494de00156e66c3e57d6dff9c79f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 22 Oct 2008 20:17:52 +0000 Subject: Dept of better ideas: refrain from creating the planner's placeholder_list until vars are distributed to rels during query_planner() startup. We don't really need it before that, and not building it early has some advantages. First, we don't need to put it through the various preprocessing steps, which saves some cycles and eliminates the need for a number of routines to support PlaceHolderInfo nodes at all. Second, this means one less unused plan for any sub-SELECT appearing in a placeholder's expression, since we don't build placeholder_list until after sublink expansion is complete. --- src/backend/optimizer/util/var.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'src/backend/optimizer/util/var.c') diff --git a/src/backend/optimizer/util/var.c b/src/backend/optimizer/util/var.c index 31749e46c05..235e465d18f 100644 --- a/src/backend/optimizer/util/var.c +++ b/src/backend/optimizer/util/var.c @@ -14,7 +14,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.81 2008/10/21 20:42:53 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.82 2008/10/22 20:17:52 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -800,24 +800,6 @@ flatten_join_alias_vars_mutator(Node *node, } return (Node *) phv; } - if (IsA(node, PlaceHolderInfo)) - { - /* Copy the PlaceHolderInfo node with correct mutation of subnodes */ - PlaceHolderInfo *phinfo; - - phinfo = (PlaceHolderInfo *) expression_tree_mutator(node, - flatten_join_alias_vars_mutator, - (void *) context); - /* now fix PlaceHolderInfo's relid sets */ - if (context->sublevels_up == 0) - { - phinfo->ph_eval_at = alias_relid_set(context->root, - phinfo->ph_eval_at); - phinfo->ph_needed = alias_relid_set(context->root, - phinfo->ph_needed); - } - return (Node *) phinfo; - } if (IsA(node, Query)) { @@ -834,6 +816,9 @@ flatten_join_alias_vars_mutator(Node *node, } /* Already-planned tree not supported */ Assert(!IsA(node, SubPlan)); + /* Shouldn't need to handle these planner auxiliary nodes here */ + Assert(!IsA(node, SpecialJoinInfo)); + Assert(!IsA(node, PlaceHolderInfo)); return expression_tree_mutator(node, flatten_join_alias_vars_mutator, (void *) context); -- cgit v1.2.3