summaryrefslogtreecommitdiff
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.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 831c55ce787..713e926329c 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -3093,6 +3093,9 @@ EvalPlanQualStart(EPQState *epqstate, Plan *planTree)
rcestate->es_part_prune_states = parentestate->es_part_prune_states;
rcestate->es_part_prune_results = parentestate->es_part_prune_results;
+ /* We'll also borrow the es_partition_directory from the parent state */
+ rcestate->es_partition_directory = parentestate->es_partition_directory;
+
/*
* Initialize private state information for each SubPlan. We must do this
* before running ExecInitNode on the main query tree, since
@@ -3210,6 +3213,13 @@ EvalPlanQualEnd(EPQState *epqstate)
MemoryContextSwitchTo(oldcontext);
+ /*
+ * NULLify the partition directory before freeing the executor state.
+ * Since EvalPlanQualStart() just borrowed the parent EState's directory,
+ * we'd better leave it up to the parent to delete it.
+ */
+ estate->es_partition_directory = NULL;
+
FreeExecutorState(estate);
/* Mark EPQState idle */