Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8d396a0

Browse files
committed
Remove duplicate code in planner.c.
I noticed while hacking on join UNION transforms that planner.c'sfunction get_base_rel_indexes() just duplicates the functionality ofget_relids_in_jointree(). It doesn't even have the excuse of beingolder code :-(. Drop it and use the latter function instead.
1 parent0dfa89b commit8d396a0

File tree

1 file changed

+1
-47
lines changed

1 file changed

+1
-47
lines changed

‎src/backend/optimizer/plan/planner.c

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,52 +2098,6 @@ is_dummy_plan(Plan *plan)
20982098
return false;
20992099
}
21002100

2101-
/*
2102-
* Create a bitmapset of the RT indexes of live base relations
2103-
*
2104-
* Helper for preprocess_rowmarks ... at this point in the proceedings,
2105-
* the only good way to distinguish baserels from appendrel children
2106-
* is to see what is in the join tree.
2107-
*/
2108-
staticBitmapset*
2109-
get_base_rel_indexes(Node*jtnode)
2110-
{
2111-
Bitmapset*result;
2112-
2113-
if (jtnode==NULL)
2114-
returnNULL;
2115-
if (IsA(jtnode,RangeTblRef))
2116-
{
2117-
intvarno= ((RangeTblRef*)jtnode)->rtindex;
2118-
2119-
result=bms_make_singleton(varno);
2120-
}
2121-
elseif (IsA(jtnode,FromExpr))
2122-
{
2123-
FromExpr*f= (FromExpr*)jtnode;
2124-
ListCell*l;
2125-
2126-
result=NULL;
2127-
foreach(l,f->fromlist)
2128-
result=bms_join(result,
2129-
get_base_rel_indexes(lfirst(l)));
2130-
}
2131-
elseif (IsA(jtnode,JoinExpr))
2132-
{
2133-
JoinExpr*j= (JoinExpr*)jtnode;
2134-
2135-
result=bms_join(get_base_rel_indexes(j->larg),
2136-
get_base_rel_indexes(j->rarg));
2137-
}
2138-
else
2139-
{
2140-
elog(ERROR,"unrecognized node type: %d",
2141-
(int)nodeTag(jtnode));
2142-
result=NULL;/* keep compiler quiet */
2143-
}
2144-
returnresult;
2145-
}
2146-
21472101
/*
21482102
* preprocess_rowmarks - set up PlanRowMarks if needed
21492103
*/
@@ -2183,7 +2137,7 @@ preprocess_rowmarks(PlannerInfo *root)
21832137
* make a bitmapset of all base rels and then remove the items we don't
21842138
* need or have FOR [KEY] UPDATE/SHARE marks for.
21852139
*/
2186-
rels=get_base_rel_indexes((Node*)parse->jointree);
2140+
rels=get_relids_in_jointree((Node*)parse->jointree, false);
21872141
if (parse->resultRelation)
21882142
rels=bms_del_member(rels,parse->resultRelation);
21892143

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp