aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execMain.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r--src/backend/executor/execMain.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 3a9ce992a3b..ee5c3a60ff3 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -2888,32 +2888,12 @@ EvalPlanQualStart(EPQState *epqstate, Plan *planTree)
}
/*
- * These arrays are reused across different plans set with
- * EvalPlanQualSetPlan(), which is safe because they all use the same
- * parent EState. Therefore we can reuse if already allocated.
- */
- if (epqstate->relsubs_rowmark == NULL)
- {
- Assert(epqstate->relsubs_done == NULL);
- epqstate->relsubs_rowmark = (ExecAuxRowMark **)
- palloc0(rtsize * sizeof(ExecAuxRowMark *));
- epqstate->relsubs_done = (bool *)
- palloc0(rtsize * sizeof(bool));
- }
- else
- {
- Assert(epqstate->relsubs_done != NULL);
- memset(epqstate->relsubs_rowmark, 0,
- rtsize * sizeof(ExecAuxRowMark *));
- memset(epqstate->relsubs_done, 0,
- rtsize * sizeof(bool));
- }
-
- /*
* Build an RTI indexed array of rowmarks, so that
* EvalPlanQualFetchRowMark() can efficiently access the to be fetched
* rowmark.
*/
+ epqstate->relsubs_rowmark = (ExecAuxRowMark **)
+ palloc0(rtsize * sizeof(ExecAuxRowMark *));
foreach(l, epqstate->arowMarks)
{
ExecAuxRowMark *earm = (ExecAuxRowMark *) lfirst(l);
@@ -2922,6 +2902,12 @@ EvalPlanQualStart(EPQState *epqstate, Plan *planTree)
}
/*
+ * Initialize per-relation EPQ tuple states to not-fetched.
+ */
+ epqstate->relsubs_done = (bool *)
+ palloc0(rtsize * sizeof(bool));
+
+ /*
* Initialize the private state information for all the nodes in the part
* of the plan tree we need to run. This opens files, allocates storage
* and leaves us ready to start processing tuples.
@@ -2989,7 +2975,9 @@ EvalPlanQualEnd(EPQState *epqstate)
FreeExecutorState(estate);
/* Mark EPQState idle */
+ epqstate->origslot = NULL;
epqstate->recheckestate = NULL;
epqstate->recheckplanstate = NULL;
- epqstate->origslot = NULL;
+ epqstate->relsubs_rowmark = NULL;
+ epqstate->relsubs_done = NULL;
}