diff --git a/src/backend/distributed/executor/subplan_execution.c b/src/backend/distributed/executor/subplan_execution.c index 5a3449dfe..72a5860a5 100644 --- a/src/backend/distributed/executor/subplan_execution.c +++ b/src/backend/distributed/executor/subplan_execution.c @@ -34,9 +34,17 @@ ExecuteSubPlans(DistributedPlan *distributedPlan) uint64 planId = distributedPlan->planId; List *subPlanList = distributedPlan->subPlanList; ListCell *subPlanCell = NULL; - List *nodeList = ActiveReadableNodeList(); + List *nodeList = NIL; bool writeLocalFile = false; + if (subPlanList == NIL) + { + /* no subplans to execute */ + return; + } + + nodeList = ActiveReadableNodeList(); + foreach(subPlanCell, subPlanList) { DistributedSubPlan *subPlan = (DistributedSubPlan *) lfirst(subPlanCell);