aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2024-01-09 10:12:14 +0200
committerAlexander Korotkov <akorotkov@postgresql.org>2024-01-09 10:12:14 +0200
commit028b15405b4113e1b0f492bf9908d001a5983a77 (patch)
treef1797185461d975da13256e0b3047843e9b9751e /src
parent8c441c082797f22ae96f50b641a8ef3f65c92b8d (diff)
downloadpostgresql-028b15405b4113e1b0f492bf9908d001a5983a77.tar.gz
postgresql-028b15405b4113e1b0f492bf9908d001a5983a77.zip
An addition to 8c441c08279
Given that now SJE doesn't work with result relation, turn a code dealing with that into an assert that it shouldn't happen.
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/plan/analyzejoins.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/backend/optimizer/plan/analyzejoins.c b/src/backend/optimizer/plan/analyzejoins.c
index 1f2167a11de..8a2ccbb6047 100644
--- a/src/backend/optimizer/plan/analyzejoins.c
+++ b/src/backend/optimizer/plan/analyzejoins.c
@@ -1900,8 +1900,10 @@ remove_self_join_rel(PlannerInfo *root, PlanRowMark *kmark, PlanRowMark *rmark,
/* Replace varno in all the query structures */
query_tree_walker(root->parse, replace_varno_walker, &ctx,
QTW_EXAMINE_SORTGROUP);
- if (root->parse->resultRelation == toRemove->relid)
- root->parse->resultRelation = toKeep->relid;
+
+ /* See remove_self_joins_one_group() */
+ Assert(root->parse->resultRelation != toRemove->relid);
+ Assert(root->parse->resultRelation != toKeep->relid);
/* Replace links in the planner info */
remove_rel_from_query(root, toRemove, toKeep->relid, NULL, NULL);