diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c index c227282975a..1ae21d5f6c4 100644 --- a/src/backend/executor/execProcnode.c +++ b/src/backend/executor/execProcnode.c @@ -746,8 +746,6 @@ ExecShutdownNode(PlanState *node) check_stack_depth(); - planstate_tree_walker(node, ExecShutdownNode, NULL); - /* * Treat the node as running while we shut it down, but only if it's run * at least once already. We don't expect much CPU consumption during @@ -761,6 +759,8 @@ ExecShutdownNode(PlanState *node) if (node->instrument && node->instrument->running) InstrStartNode(node->instrument); + planstate_tree_walker(node, ExecShutdownNode, NULL); + switch (nodeTag(node)) { case T_GatherState: