1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

Get rid of the separate EState for subplans, and just let them share the

parent query's EState.  Now that there's a single flat rangetable for both
the main plan and subplans, there's no need anymore for a separate EState,
and removing it allows cleaning up some crufty code in nodeSubplan.c and
nodeSubqueryscan.c.  Should be a tad faster too, although any difference
will probably be hard to measure.  This is the last bit of subsidiary
mop-up work from changing to a flat rangetable.
This commit is contained in:
Tom Lane
2007-02-27 01:11:26 +00:00
parent 4756ff3dca
commit c7ff7663e4
15 changed files with 258 additions and 358 deletions

View File

@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execProcnode.c,v 1.60 2007/01/05 22:19:27 momjian Exp $
* $PostgreSQL: pgsql/src/backend/executor/execProcnode.c,v 1.61 2007/02/27 01:11:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -278,26 +278,11 @@ ExecInitNode(Plan *node, EState *estate, int eflags)
SubPlanState *sstate;
Assert(IsA(subplan, SubPlan));
sstate = ExecInitExprInitPlan(subplan, result);
ExecInitSubPlan(sstate, estate, eflags);
sstate = ExecInitSubPlan(subplan, result);
subps = lappend(subps, sstate);
}
result->initPlan = subps;
/*
* Initialize any subPlans present in this node. These were found by
* ExecInitExpr during initialization of the PlanState. Note we must do
* this after initializing initPlans, in case their arguments contain
* subPlans (is that actually possible? perhaps not).
*/
foreach(l, result->subPlan)
{
SubPlanState *sstate = (SubPlanState *) lfirst(l);
Assert(IsA(sstate, SubPlanState));
ExecInitSubPlan(sstate, estate, eflags);
}
/* Set up instrumentation for this node if requested */
if (estate->es_instrument)
result->instrument = InstrAlloc(1);
@ -610,20 +595,12 @@ ExecCountSlotsNode(Plan *node)
void
ExecEndNode(PlanState *node)
{
ListCell *subp;
/*
* do nothing when we get to the end of a leaf on tree.
*/
if (node == NULL)
return;
/* Clean up initPlans and subPlans */
foreach(subp, node->initPlan)
ExecEndSubPlan((SubPlanState *) lfirst(subp));
foreach(subp, node->subPlan)
ExecEndSubPlan((SubPlanState *) lfirst(subp));
if (node->chgParam != NULL)
{
bms_free(node->chgParam);