1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +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

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.213 2007/02/06 17:35:20 tgl Exp $
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.214 2007/02/27 01:11:25 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -3723,27 +3723,16 @@ ExecInitExpr(Expr *node, PlanState *parent)
break;
case T_SubPlan:
{
/* Keep this in sync with ExecInitExprInitPlan, below */
SubPlan *subplan = (SubPlan *) node;
SubPlanState *sstate = makeNode(SubPlanState);
sstate->xprstate.evalfunc = (ExprStateEvalFunc) ExecSubPlan;
SubPlanState *sstate;
if (!parent)
elog(ERROR, "SubPlan found with no parent plan");
/*
* Here we just add the SubPlanState nodes to parent->subPlan.
* The subplans will be initialized later.
*/
parent->subPlan = lcons(sstate, parent->subPlan);
sstate->sub_estate = NULL;
sstate->planstate = NULL;
sstate = ExecInitSubPlan(subplan, parent);
sstate->testexpr =
ExecInitExpr((Expr *) subplan->testexpr, parent);
sstate->args = (List *)
ExecInitExpr((Expr *) subplan->args, parent);
/* Add SubPlanState nodes to parent->subPlan */
parent->subPlan = lcons(sstate, parent->subPlan);
state = (ExprState *) sstate;
}
@ -4157,32 +4146,6 @@ ExecInitExpr(Expr *node, PlanState *parent)
return state;
}
/*
* ExecInitExprInitPlan --- initialize a subplan expr that's being handled
* as an InitPlan. This is identical to ExecInitExpr's handling of a regular
* subplan expr, except we do NOT want to add the node to the parent's
* subplan list.
*/
SubPlanState *
ExecInitExprInitPlan(SubPlan *node, PlanState *parent)
{
SubPlanState *sstate = makeNode(SubPlanState);
if (!parent)
elog(ERROR, "SubPlan found with no parent plan");
/* The subplan's state will be initialized later */
sstate->sub_estate = NULL;
sstate->planstate = NULL;
sstate->testexpr = ExecInitExpr((Expr *) node->testexpr, parent);
sstate->args = (List *) ExecInitExpr((Expr *) node->args, parent);
sstate->xprstate.expr = (Expr *) node;
return sstate;
}
/*
* ExecPrepareExpr --- initialize for expression execution outside a normal
* Plan tree context.