1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-11 10:01:57 +03:00

Fix setrefs.c code for Result Cache nodes

Result Cache, added in 9eacee2e6 neglected to properly adjust the plan
references in setrefs.c.  This could lead to the following error during
EXPLAIN:

ERROR:  cannot decompile join alias var in plan tree

Fix that.

Bug: 17030
Reported-by: Hans Buschmann
Discussion: https://postgr.es/m/17030-5844aecae42fe223@postgresql.org
This commit is contained in:
David Rowley
2021-05-25 12:50:22 +12:00
parent c242baa4a8
commit cba5c70b95
2 changed files with 19 additions and 13 deletions

View File

@ -756,6 +756,12 @@ set_plan_refs(PlannerInfo *root, Plan *plan, int rtoffset)
{
ResultCache *rcplan = (ResultCache *) plan;
/*
* Result Cache does not evaluate its targetlist. It just
* uses the same targetlist from its outer subnode.
*/
set_dummy_tlist_references(plan, rtoffset);
rcplan->param_exprs = fix_scan_list(root, rcplan->param_exprs,
rtoffset,
NUM_EXEC_TLIST(plan));