mirror of
https://github.com/postgres/postgres.git
synced 2025-09-09 13:09:39 +03:00
Replace the relid in some missing fields during SJE
Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/a89f480f-8143-0965-f22d-0a892777f501%40gmail.com Author: Andrei Lepikhov
This commit is contained in:
@@ -1866,6 +1866,8 @@ 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;
|
||||
|
||||
/* Replace links in the planner info */
|
||||
remove_rel_from_query(root, toRemove, toKeep->relid, NULL, NULL);
|
||||
@@ -1875,6 +1877,9 @@ remove_self_join_rel(PlannerInfo *root, PlanRowMark *kmark, PlanRowMark *rmark,
|
||||
toRemove->relid, toKeep->relid);
|
||||
replace_varno((Node *) root->processed_groupClause,
|
||||
toRemove->relid, toKeep->relid);
|
||||
replace_relid(root->all_result_relids, toRemove->relid, toKeep->relid);
|
||||
replace_relid(root->leaf_result_relids, toRemove->relid, toKeep->relid);
|
||||
|
||||
|
||||
/*
|
||||
* There may be references to the rel in root->fkey_list, but if so,
|
||||
|
Reference in New Issue
Block a user