aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-02-14 11:47:12 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2017-02-14 11:47:45 -0500
commit8d396a0a7046438ced8d8ada6ceb7c0756e58351 (patch)
tree4e91826425ac1406484f73f403d659e9e58ef885 /src
parent0dfa89ba2992b1be86ad3a5523a8d26dce31a08c (diff)
downloadpostgresql-8d396a0a7046438ced8d8ada6ceb7c0756e58351.tar.gz
postgresql-8d396a0a7046438ced8d8ada6ceb7c0756e58351.zip
Remove duplicate code in planner.c.
I noticed while hacking on join UNION transforms that planner.c's function get_base_rel_indexes() just duplicates the functionality of get_relids_in_jointree(). It doesn't even have the excuse of being older code :-(. Drop it and use the latter function instead.
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/plan/planner.c48
1 files changed, 1 insertions, 47 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 881742f46b6..abb4f12cea1 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -2099,52 +2099,6 @@ is_dummy_plan(Plan *plan)
}
/*
- * Create a bitmapset of the RT indexes of live base relations
- *
- * Helper for preprocess_rowmarks ... at this point in the proceedings,
- * the only good way to distinguish baserels from appendrel children
- * is to see what is in the join tree.
- */
-static Bitmapset *
-get_base_rel_indexes(Node *jtnode)
-{
- Bitmapset *result;
-
- if (jtnode == NULL)
- return NULL;
- if (IsA(jtnode, RangeTblRef))
- {
- int varno = ((RangeTblRef *) jtnode)->rtindex;
-
- result = bms_make_singleton(varno);
- }
- else if (IsA(jtnode, FromExpr))
- {
- FromExpr *f = (FromExpr *) jtnode;
- ListCell *l;
-
- result = NULL;
- foreach(l, f->fromlist)
- result = bms_join(result,
- get_base_rel_indexes(lfirst(l)));
- }
- else if (IsA(jtnode, JoinExpr))
- {
- JoinExpr *j = (JoinExpr *) jtnode;
-
- result = bms_join(get_base_rel_indexes(j->larg),
- get_base_rel_indexes(j->rarg));
- }
- else
- {
- elog(ERROR, "unrecognized node type: %d",
- (int) nodeTag(jtnode));
- result = NULL; /* keep compiler quiet */
- }
- return result;
-}
-
-/*
* preprocess_rowmarks - set up PlanRowMarks if needed
*/
static void
@@ -2183,7 +2137,7 @@ preprocess_rowmarks(PlannerInfo *root)
* make a bitmapset of all base rels and then remove the items we don't
* need or have FOR [KEY] UPDATE/SHARE marks for.
*/
- rels = get_base_rel_indexes((Node *) parse->jointree);
+ rels = get_relids_in_jointree((Node *) parse->jointree, false);
if (parse->resultRelation)
rels = bms_del_member(rels, parse->resultRelation);