Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 028b154

Browse files
committed
An addition to 8c441c0
Given that now SJE doesn't work with result relation, turn a code dealing with that into an assert that it shouldn't happen.
1 parent 8c441c0 commit 028b154

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/optimizer/plan/analyzejoins.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -1900,8 +1900,10 @@ remove_self_join_rel(PlannerInfo *root, PlanRowMark *kmark, PlanRowMark *rmark,
19001900
/* Replace varno in all the query structures */
19011901
query_tree_walker(root->parse, replace_varno_walker, &ctx,
19021902
QTW_EXAMINE_SORTGROUP);
1903-
if (root->parse->resultRelation == toRemove->relid)
1904-
root->parse->resultRelation = toKeep->relid;
1903+
1904+
/* See remove_self_joins_one_group() */
1905+
Assert(root->parse->resultRelation != toRemove->relid);
1906+
Assert(root->parse->resultRelation != toKeep->relid);
19051907

19061908
/* Replace links in the planner info */
19071909
remove_rel_from_query(root, toRemove, toKeep->relid, NULL, NULL);

0 commit comments

Comments
 (0)