From: Tom Lane Date: Fri, 30 Nov 2001 19:24:15 +0000 (+0000) Subject: Repair failure to mark an inserted Materialize node with the appropriate X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=0955879cff33a92d04f2c3c7b23fdede74fbd48d;p=users%2Fbernd%2Fpostgres.git Repair failure to mark an inserted Materialize node with the appropriate extParam/locParam lists. Per bug #526. --- diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c index 9be839cfde..d02cf7b66e 100644 --- a/src/backend/optimizer/plan/subselect.c +++ b/src/backend/optimizer/plan/subselect.c @@ -324,6 +324,12 @@ make_subplan(SubLink *slink) * is anything more complicated than a plain sequential scan, and * we do it even for seqscan if the qual appears selective enough * to eliminate many tuples. + * + * XXX It's pretty ugly to be inserting a MATERIAL node at this + * point. Since subquery_planner has already run SS_finalize_plan + * on the subplan tree, we have to kluge up parameter lists for + * the MATERIAL node. Possibly this could be fixed by postponing + * SS_finalize_plan processing until setrefs.c is run. */ if (node->parParam == NIL) { @@ -362,8 +368,13 @@ make_subplan(SubLink *slink) } if (use_material) { - plan = (Plan *) make_material(plan->targetlist, plan); - node->plan = plan; + Plan *matplan; + + matplan = (Plan *) make_material(plan->targetlist, plan); + /* kluge --- see comments above */ + matplan->extParam = listCopy(plan->extParam); + matplan->locParam = listCopy(plan->locParam); + node->plan = plan = matplan; } }