We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 979a36c commit 9c64dddCopy full SHA for 9c64ddd
src/backend/executor/nodeAppend.c
@@ -506,8 +506,16 @@ choose_next_subplan_for_worker(AppendState *node)
506
node->as_whichplan = pstate->pa_next_plan++;
507
if (pstate->pa_next_plan >= node->as_nplans)
508
{
509
- Assert(append->first_partial_plan < node->as_nplans);
510
- pstate->pa_next_plan = append->first_partial_plan;
+ if (append->first_partial_plan < node->as_nplans)
+ pstate->pa_next_plan = append->first_partial_plan;
511
+ else
512
+ {
513
+ /*
514
+ * We have only non-partial plans, and we already chose the last
515
+ * one; so arrange for the other workers to immediately bail out.
516
+ */
517
+ pstate->pa_next_plan = INVALID_SUBPLAN_INDEX;
518
+ }
519
}
520
521
/* If non-partial, immediately mark as finished. */
0 commit comments