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.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index b797d064b7e..c583e020a0e 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -1726,8 +1726,12 @@ ExecutePlan(EState *estate,
*/
if (TupIsNull(slot))
{
- /* Allow nodes to release or shut down resources. */
- (void) ExecShutdownNode(planstate);
+ /*
+ * If we know we won't need to back up, we can release
+ * resources at this point.
+ */
+ if (!(estate->es_top_eflags & EXEC_FLAG_BACKWARD))
+ (void) ExecShutdownNode(planstate);
break;
}
@@ -1773,8 +1777,12 @@ ExecutePlan(EState *estate,
current_tuple_count++;
if (numberTuples && numberTuples == current_tuple_count)
{
- /* Allow nodes to release or shut down resources. */
- (void) ExecShutdownNode(planstate);
+ /*
+ * If we know we won't need to back up, we can release
+ * resources at this point.
+ */
+ if (!(estate->es_top_eflags & EXEC_FLAG_BACKWARD))
+ (void) ExecShutdownNode(planstate);
break;
}
}