if (splan->plan->extParam != NULL)
UpdateChangedParamSet(splan, node->chgParam);
}
- /* Well. Now set chgParam for left/right trees. */
- if (node->lefttree != NULL)
- UpdateChangedParamSet(node->lefttree, node->chgParam);
- if (node->righttree != NULL)
- UpdateChangedParamSet(node->righttree, node->chgParam);
+ /* Well. Now set chgParam for child trees. */
+ if (outerPlanState(node) != NULL)
+ UpdateChangedParamSet(outerPlanState(node), node->chgParam);
+ if (innerPlanState(node) != NULL)
+ UpdateChangedParamSet(innerPlanState(node), node->chgParam);
}
/* Call expression callbacks */
*/
case T_ResultState:
case T_LimitState:
- result = search_plan_tree(node->lefttree,
+ result = search_plan_tree(outerPlanState(node),
table_oid,
pending_rescan);
break;
if (phaseidx > 0)
{
aggnode = list_nth_node(Agg, node->chain, phaseidx - 1);
- sortnode = castNode(Sort, aggnode->plan.lefttree);
+ sortnode = castNode(Sort, outerPlan(aggnode));
}
else
{
/* Initialize, or re-initialize, shared state needed by workers. */
if (!node->pei)
- node->pei = ExecInitParallelPlan(node->ps.lefttree,
+ node->pei = ExecInitParallelPlan(outerPlanState(node),
estate,
gather->initParam,
gather->num_workers,
node->tuples_needed);
else
- ExecParallelReinitialize(node->ps.lefttree,
+ ExecParallelReinitialize(outerPlanState(node),
node->pei,
gather->initParam);
/* Initialize, or re-initialize, shared state needed by workers. */
if (!node->pei)
- node->pei = ExecInitParallelPlan(node->ps.lefttree,
+ node->pei = ExecInitParallelPlan(outerPlanState(node),
estate,
gm->initParam,
gm->num_workers,
node->tuples_needed);
else
- ExecParallelReinitialize(node->ps.lefttree,
+ ExecParallelReinitialize(outerPlanState(node),
node->pei,
gm->initParam);
void
ExecReScanHash(HashState *node)
{
+ PlanState *outerPlan = outerPlanState(node);
+
/*
* if chgParam of subnode is not null then plan will be re-scanned by
* first ExecProcNode.
*/
- if (node->ps.lefttree->chgParam == NULL)
- ExecReScan(node->ps.lefttree);
+ if (outerPlan->chgParam == NULL)
+ ExecReScan(outerPlan);
}
void
ExecReScanHashJoin(HashJoinState *node)
{
+ PlanState *outerPlan = outerPlanState(node);
+ PlanState *innerPlan = innerPlanState(node);
+
/*
* In a multi-batch join, we currently have to do rescans the hard way,
* primarily because batch temp files may have already been released. But
if (node->hj_HashTable != NULL)
{
if (node->hj_HashTable->nbatch == 1 &&
- node->js.ps.righttree->chgParam == NULL)
+ innerPlan->chgParam == NULL)
{
/*
* Okay to reuse the hash table; needn't rescan inner, either.
else
{
/* must destroy and rebuild hash table */
- HashState *hashNode = castNode(HashState, innerPlanState(node));
+ HashState *hashNode = castNode(HashState, innerPlan);
Assert(hashNode->hashtable == node->hj_HashTable);
/* accumulate stats from old hash table, if wanted */
* if chgParam of subnode is not null then plan will be re-scanned
* by first ExecProcNode.
*/
- if (node->js.ps.righttree->chgParam == NULL)
- ExecReScan(node->js.ps.righttree);
+ if (innerPlan->chgParam == NULL)
+ ExecReScan(innerPlan);
}
}
* if chgParam of subnode is not null then plan will be re-scanned by
* first ExecProcNode.
*/
- if (node->js.ps.lefttree->chgParam == NULL)
- ExecReScan(node->js.ps.lefttree);
+ if (outerPlan->chgParam == NULL)
+ ExecReScan(outerPlan);
}
void
void
ExecReScanLimit(LimitState *node)
{
+ PlanState *outerPlan = outerPlanState(node);
+
/*
* Recompute limit/offset in case parameters changed, and reset the state
* machine. We must do this before rescanning our child node, in case
* if chgParam of subnode is not null then plan will be re-scanned by
* first ExecProcNode.
*/
- if (node->ps.lefttree->chgParam == NULL)
- ExecReScan(node->ps.lefttree);
+ if (outerPlan->chgParam == NULL)
+ ExecReScan(outerPlan);
}
void
ExecReScanLockRows(LockRowsState *node)
{
+ PlanState *outerPlan = outerPlanState(node);
+
/*
* if chgParam of subnode is not null then plan will be re-scanned by
* first ExecProcNode.
*/
- if (node->ps.lefttree->chgParam == NULL)
- ExecReScan(node->ps.lefttree);
+ if (outerPlan->chgParam == NULL)
+ ExecReScan(outerPlan);
}
void
ExecReScanMergeJoin(MergeJoinState *node)
{
+ PlanState *outerPlan = outerPlanState(node);
+ PlanState *innerPlan = innerPlanState(node);
+
ExecClearTuple(node->mj_MarkedTupleSlot);
node->mj_JoinState = EXEC_MJ_INITIALIZE_OUTER;
* if chgParam of subnodes is not null then plans will be re-scanned by
* first ExecProcNode.
*/
- if (node->js.ps.lefttree->chgParam == NULL)
- ExecReScan(node->js.ps.lefttree);
- if (node->js.ps.righttree->chgParam == NULL)
- ExecReScan(node->js.ps.righttree);
+ if (outerPlan->chgParam == NULL)
+ ExecReScan(outerPlan);
+ if (innerPlan->chgParam == NULL)
+ ExecReScan(innerPlan);
}
void
ExecReScanProjectSet(ProjectSetState *node)
{
+ PlanState *outerPlan = outerPlanState(node);
+
/* Forget any incompletely-evaluated SRFs */
node->pending_srf_tuples = false;
* If chgParam of subnode is not null then plan will be re-scanned by
* first ExecProcNode.
*/
- if (node->ps.lefttree->chgParam == NULL)
- ExecReScan(node->ps.lefttree);
+ if (outerPlan->chgParam == NULL)
+ ExecReScan(outerPlan);
}
void
ExecReScanResult(ResultState *node)
{
+ PlanState *outerPlan = outerPlanState(node);
+
node->rs_done = false;
node->rs_checkqual = (node->resconstantqual != NULL);
* If chgParam of subnode is not null then plan will be re-scanned by
* first ExecProcNode.
*/
- if (node->ps.lefttree &&
- node->ps.lefttree->chgParam == NULL)
- ExecReScan(node->ps.lefttree);
+ if (outerPlan && outerPlan->chgParam == NULL)
+ ExecReScan(outerPlan);
}
void
ExecReScanSetOp(SetOpState *node)
{
+ PlanState *outerPlan = outerPlanState(node);
+
ExecClearTuple(node->ps.ps_ResultTupleSlot);
node->setop_done = false;
node->numOutput = 0;
* parameter changes, then we can just rescan the existing hash table;
* no need to build it again.
*/
- if (node->ps.lefttree->chgParam == NULL)
+ if (outerPlan->chgParam == NULL)
{
ResetTupleHashIterator(node->hashtable, &node->hashiter);
return;
* if chgParam of subnode is not null then plan will be re-scanned by
* first ExecProcNode.
*/
- if (node->ps.lefttree->chgParam == NULL)
- ExecReScan(node->ps.lefttree);
+ if (outerPlan->chgParam == NULL)
+ ExecReScan(outerPlan);
}
void
ExecReScanUnique(UniqueState *node)
{
+ PlanState *outerPlan = outerPlanState(node);
+
/* must clear result tuple so first input tuple is returned */
ExecClearTuple(node->ps.ps_ResultTupleSlot);
* if chgParam of subnode is not null then plan will be re-scanned by
* first ExecProcNode.
*/
- if (node->ps.lefttree->chgParam == NULL)
- ExecReScan(node->ps.lefttree);
+ if (outerPlan->chgParam == NULL)
+ ExecReScan(outerPlan);
}