aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execProcnode.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-12-13 19:46:01 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-12-13 19:46:01 +0000
commit3a4f7dde16ad81b2319b9a4924a6023710a2fefd (patch)
tree248cf66fd94d40072b5ba8bb8e5437a6ea8399e5 /src/backend/executor/execProcnode.c
parent77b7a740f95250af7d78f69e9c906c3e53f32e7b (diff)
downloadpostgresql-3a4f7dde16ad81b2319b9a4924a6023710a2fefd.tar.gz
postgresql-3a4f7dde16ad81b2319b9a4924a6023710a2fefd.zip
Phase 3 of read-only-plans project: ExecInitExpr now builds expression
execution state trees, and ExecEvalExpr takes an expression state tree not an expression plan tree. The plan tree is now read-only as far as the executor is concerned. Next step is to begin actually exploiting this property.
Diffstat (limited to 'src/backend/executor/execProcnode.c')
-rw-r--r--src/backend/executor/execProcnode.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c
index 680a6da609b..59c798b267a 100644
--- a/src/backend/executor/execProcnode.c
+++ b/src/backend/executor/execProcnode.c
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.32 2002/12/12 15:49:24 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.33 2002/12/13 19:45:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -229,23 +229,29 @@ ExecInitNode(Plan *node, EState *estate)
foreach(subp, node->initPlan)
{
SubPlanExpr *subplan = (SubPlanExpr *) lfirst(subp);
+ SubPlanExprState *sstate;
Assert(IsA(subplan, SubPlanExpr));
- subps = lappend(subps, ExecInitSubPlan(subplan, estate));
+ sstate = ExecInitExprInitPlan(subplan, result);
+ ExecInitSubPlan(sstate, estate);
+ subps = lappend(subps, sstate);
}
result->initPlan = subps;
/*
* Initialize any subPlans present in this node. These were found
- * by ExecInitExpr during initialization of the PlanState.
+ * 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).
*/
subps = NIL;
foreach(subp, result->subPlan)
{
- SubPlanExpr *subplan = (SubPlanExpr *) lfirst(subp);
+ SubPlanExprState *sstate = (SubPlanExprState *) lfirst(subp);
- Assert(IsA(subplan, SubPlanExpr));
- subps = lappend(subps, ExecInitSubPlan(subplan, estate));
+ Assert(IsA(sstate, SubPlanExprState));
+ ExecInitSubPlan(sstate, estate);
+ subps = lappend(subps, sstate);
}
result->subPlan = subps;
@@ -492,14 +498,11 @@ ExecEndNode(PlanState *node)
if (node == NULL)
return;
- if (node->instrument)
- InstrEndLoop(node->instrument);
-
/* Clean up initPlans and subPlans */
foreach(subp, node->initPlan)
- ExecEndSubPlan((SubPlanState *) lfirst(subp));
+ ExecEndSubPlan((SubPlanExprState *) lfirst(subp));
foreach(subp, node->subPlan)
- ExecEndSubPlan((SubPlanState *) lfirst(subp));
+ ExecEndSubPlan((SubPlanExprState *) lfirst(subp));
if (node->chgParam != NIL)
{