Skip to content

Commit c31bcbc

Browse files
committed
Repair failure to mark an inserted Materialize node with the appropriate
extParam/locParam lists. Per bug #526.
1 parent 22a6a7e commit c31bcbc

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/backend/optimizer/plan/subselect.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.49 2001/03/22 03:59:37 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.50 2001/11/30 19:24:15 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -324,6 +324,12 @@ make_subplan(SubLink *slink)
324324
* is anything more complicated than a plain sequential scan, and
325325
* we do it even for seqscan if the qual appears selective enough
326326
* to eliminate many tuples.
327+
*
328+
* XXX It's pretty ugly to be inserting a MATERIAL node at this
329+
* point. Since subquery_planner has already run SS_finalize_plan
330+
* on the subplan tree, we have to kluge up parameter lists for
331+
* the MATERIAL node. Possibly this could be fixed by postponing
332+
* SS_finalize_plan processing until setrefs.c is run.
327333
*/
328334
if (node->parParam == NIL)
329335
{
@@ -362,8 +368,13 @@ make_subplan(SubLink *slink)
362368
}
363369
if (use_material)
364370
{
365-
plan = (Plan *) make_material(plan->targetlist, plan);
366-
node->plan = plan;
371+
Plan *matplan;
372+
373+
matplan = (Plan *) make_material(plan->targetlist, plan);
374+
/* kluge --- see comments above */
375+
matplan->extParam = listCopy(plan->extParam);
376+
matplan->locParam = listCopy(plan->locParam);
377+
node->plan = plan = matplan;
367378
}
368379
}
369380

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy