diff options
| author | Tom Lane | 2019-01-29 20:26:44 +0000 |
|---|---|---|
| committer | Tom Lane | 2019-01-29 20:26:44 +0000 |
| commit | a1b8c41e990ec0f083e9b684700a07640d5a356a (patch) | |
| tree | daa26b95223c1e2a09507973853aa77b91df7644 /src/backend/optimizer/prep/prepjointree.c | |
| parent | e77cfa54d700557ea700d47454c9e570f20f1841 (diff) | |
Make some small planner API cleanups.
Move a few very simple node-creation and node-type-testing functions
from the planner's clauses.c to nodes/makefuncs and nodes/nodeFuncs.
There's nothing planner-specific about them, as evidenced by the
number of other places that were using them.
While at it, rename and_clause() etc to is_andclause() etc, to clarify
that they are node-type-testing functions not node-creation functions.
And use "static inline" implementations for the shortest ones.
Also, modify flatten_join_alias_vars() and some subsidiary functions
to take a Query not a PlannerInfo to define the join structure that
Vars should be translated according to. They were only using the
"parse" field of the PlannerInfo anyway, so this just requires removing
one level of indirection. The advantage is that now parse_agg.c can
use flatten_join_alias_vars() without the horrid kluge of creating an
incomplete PlannerInfo, which will allow that file to be decoupled from
relation.h in a subsequent patch.
Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/backend/optimizer/prep/prepjointree.c')
| -rw-r--r-- | src/backend/optimizer/prep/prepjointree.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/optimizer/prep/prepjointree.c b/src/backend/optimizer/prep/prepjointree.c index bcbca1a0f50..1f64004cf61 100644 --- a/src/backend/optimizer/prep/prepjointree.c +++ b/src/backend/optimizer/prep/prepjointree.c @@ -497,7 +497,7 @@ pull_up_sublinks_qual_recurse(PlannerInfo *root, Node *node, /* Else return it unmodified */ return node; } - if (not_clause(node)) + if (is_notclause(node)) { /* If the immediate argument of NOT is EXISTS, try to convert */ SubLink *sublink = (SubLink *) get_notclausearg((Expr *) node); @@ -564,7 +564,7 @@ pull_up_sublinks_qual_recurse(PlannerInfo *root, Node *node, /* Else return it unmodified */ return node; } - if (and_clause(node)) + if (is_andclause(node)) { /* Recurse into AND clause */ List *newclauses = NIL; @@ -968,7 +968,7 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, * maybe even in the rewriter; but for now let's just fix this case here.) */ subquery->targetList = (List *) - flatten_join_alias_vars(subroot, (Node *) subquery->targetList); + flatten_join_alias_vars(subroot->parse, (Node *) subquery->targetList); /* * Adjust level-0 varnos in subquery so that we can append its rangetable @@ -3317,11 +3317,11 @@ get_relids_in_jointree(Node *jtnode, bool include_joins) * get_relids_for_join: get set of base RT indexes making up a join */ Relids -get_relids_for_join(PlannerInfo *root, int joinrelid) +get_relids_for_join(Query *query, int joinrelid) { Node *jtnode; - jtnode = find_jointree_node_for_rel((Node *) root->parse->jointree, + jtnode = find_jointree_node_for_rel((Node *) query->jointree, joinrelid); if (!jtnode) elog(ERROR, "could not find join node %d", joinrelid); |
