diff options
Diffstat (limited to 'src/backend/optimizer/prep/prepjointree.c')
-rw-r--r-- | src/backend/optimizer/prep/prepjointree.c | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/src/backend/optimizer/prep/prepjointree.c b/src/backend/optimizer/prep/prepjointree.c index 914703227f4..bcc1fe2be33 100644 --- a/src/backend/optimizer/prep/prepjointree.c +++ b/src/backend/optimizer/prep/prepjointree.c @@ -16,7 +16,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.70 2010/01/02 16:57:47 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.71 2010/02/26 02:00:46 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -39,13 +39,13 @@ typedef struct pullup_replace_vars_context { PlannerInfo *root; - List *targetlist; /* tlist of subquery being pulled up */ - RangeTblEntry *target_rte; /* RTE of subquery */ - bool *outer_hasSubLinks; /* -> outer query's hasSubLinks */ - int varno; /* varno of subquery */ - bool need_phvs; /* do we need PlaceHolderVars? */ - bool wrap_non_vars; /* do we need 'em on *all* non-Vars? */ - Node **rv_cache; /* cache for results with PHVs */ + List *targetlist; /* tlist of subquery being pulled up */ + RangeTblEntry *target_rte; /* RTE of subquery */ + bool *outer_hasSubLinks; /* -> outer query's hasSubLinks */ + int varno; /* varno of subquery */ + bool need_phvs; /* do we need PlaceHolderVars? */ + bool wrap_non_vars; /* do we need 'em on *all* non-Vars? */ + Node **rv_cache; /* cache for results with PHVs */ } pullup_replace_vars_context; typedef struct reduce_outer_joins_state @@ -79,7 +79,7 @@ static void replace_vars_in_jointree(Node *jtnode, pullup_replace_vars_context *context, JoinExpr *lowest_outer_join); static Node *pullup_replace_vars(Node *expr, - pullup_replace_vars_context *context); + pullup_replace_vars_context *context); static Node *pullup_replace_vars_callback(Var *var, replace_rte_variables_context *context); static reduce_outer_joins_state *reduce_outer_joins_pass1(Node *jtnode); @@ -708,7 +708,7 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, * insert into the top query, but if we are under an outer join then * non-nullable items may have to be turned into PlaceHolderVars. If we * are dealing with an appendrel member then anything that's not a simple - * Var has to be turned into a PlaceHolderVar. Set up appropriate context + * Var has to be turned into a PlaceHolderVar. Set up appropriate context * data for pullup_replace_vars. */ rvcontext.root = root; @@ -729,7 +729,7 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, * replace any of the jointree structure. (This'd be a lot cleaner if we * could use query_tree_mutator.) We have to use PHVs in the targetList, * returningList, and havingQual, since those are certainly above any - * outer join. replace_vars_in_jointree tracks its location in the + * outer join. replace_vars_in_jointree tracks its location in the * jointree and uses PHVs or not appropriately. */ parse->targetList = (List *) @@ -751,7 +751,7 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, foreach(lc, root->append_rel_list) { AppendRelInfo *appinfo = (AppendRelInfo *) lfirst(lc); - bool save_need_phvs = rvcontext.need_phvs; + bool save_need_phvs = rvcontext.need_phvs; if (appinfo == containing_appendrel) rvcontext.need_phvs = false; @@ -796,9 +796,8 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, * We also have to fix the relid sets of any PlaceHolderVar nodes in the * parent query. (This could perhaps be done by pullup_replace_vars(), * but it seems cleaner to use two passes.) Note in particular that any - * PlaceHolderVar nodes just created by pullup_replace_vars() - * will be adjusted, so having created them with the subquery's varno is - * correct. + * PlaceHolderVar nodes just created by pullup_replace_vars() will be + * adjusted, so having created them with the subquery's varno is correct. * * Likewise, relids appearing in AppendRelInfo nodes have to be fixed. We * already checked that this won't require introducing multiple subrelids @@ -1033,8 +1032,8 @@ is_simple_subquery(Query *subquery) * * We also don't pull up a subquery that has explicit FOR UPDATE/SHARE * clauses, because pullup would cause the locking to occur semantically - * higher than it should. Implicit FOR UPDATE/SHARE is okay because - * in that case the locking was originally declared in the upper query + * higher than it should. Implicit FOR UPDATE/SHARE is okay because in + * that case the locking was originally declared in the upper query * anyway. */ if (subquery->hasAggs || @@ -1227,7 +1226,7 @@ replace_vars_in_jointree(Node *jtnode, else if (IsA(jtnode, JoinExpr)) { JoinExpr *j = (JoinExpr *) jtnode; - bool save_need_phvs = context->need_phvs; + bool save_need_phvs = context->need_phvs; if (j == lowest_outer_join) { @@ -1310,7 +1309,7 @@ pullup_replace_vars_callback(Var *var, * expansion with varlevelsup = 0, and then adjust if needed. */ expandRTE(rcon->target_rte, - var->varno, 0 /* not varlevelsup */, var->location, + var->varno, 0 /* not varlevelsup */ , var->location, (var->vartype != RECORDOID), &colnames, &fields); /* Adjust the generated per-field Vars, but don't insert PHVs */ @@ -1327,11 +1326,11 @@ pullup_replace_vars_callback(Var *var, newnode = (Node *) rowexpr; /* - * Insert PlaceHolderVar if needed. Notice that we are wrapping - * one PlaceHolderVar around the whole RowExpr, rather than putting - * one around each element of the row. This is because we need - * the expression to yield NULL, not ROW(NULL,NULL,...) when it - * is forced to null by an outer join. + * Insert PlaceHolderVar if needed. Notice that we are wrapping one + * PlaceHolderVar around the whole RowExpr, rather than putting one + * around each element of the row. This is because we need the + * expression to yield NULL, not ROW(NULL,NULL,...) when it is forced + * to null by an outer join. */ if (rcon->need_phvs) { @@ -1359,7 +1358,7 @@ pullup_replace_vars_callback(Var *var, /* Insert PlaceHolderVar if needed */ if (rcon->need_phvs) { - bool wrap; + bool wrap; if (newnode && IsA(newnode, Var) && ((Var *) newnode)->varlevelsup == 0) @@ -1402,8 +1401,8 @@ pullup_replace_vars_callback(Var *var, /* * Cache it if possible (ie, if the attno is in range, which it - * probably always should be). We can cache the value even if - * we decided we didn't need a PHV, since this result will be + * probably always should be). We can cache the value even if we + * decided we didn't need a PHV, since this result will be * suitable for any request that has need_phvs. */ if (varattno > InvalidAttrNumber && @@ -1837,7 +1836,7 @@ reduce_outer_joins_pass2(Node *jtnode, * top query could (yet) contain such a reference. * * NOTE: although this has the form of a walker, we cheat and modify the - * nodes in-place. This should be OK since the tree was copied by + * nodes in-place. This should be OK since the tree was copied by * pullup_replace_vars earlier. Avoid scribbling on the original values of * the bitmapsets, though, because expression_tree_mutator doesn't copy those. */ |