mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Fix missed step in removal of useless RESULT RTEs in the planner.
Commit 4be058fe9
forgot that the append_rel_list would already be
populated at the time we remove useless result RTEs, and it might contain
PlaceHolderVars that need to be adjusted like the ones in the main parse
tree. This could lead to "no relation entry for relid N" failures later
on, when the planner tries to do something with an unadjusted PHV.
Per report from Tom Ellis. Back-patch to v12 where the bug came in.
Discussion: https://postgr.es/m/20201205173056.GF30712@cloudinit-builder
This commit is contained in:
@ -3256,6 +3256,7 @@ remove_result_refs(PlannerInfo *root, int varno, Node *newjtloc)
|
||||
subrelids = get_relids_in_jointree(newjtloc, false);
|
||||
Assert(!bms_is_empty(subrelids));
|
||||
substitute_phv_relids((Node *) root->parse, varno, subrelids);
|
||||
fix_append_rel_relids(root->append_rel_list, varno, subrelids);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user