diff options
Diffstat (limited to 'src/backend/optimizer/plan/setrefs.c')
-rw-r--r-- | src/backend/optimizer/plan/setrefs.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c index 1dc956c3f0d..2adeaf67811 100644 --- a/src/backend/optimizer/plan/setrefs.c +++ b/src/backend/optimizer/plan/setrefs.c @@ -1159,7 +1159,19 @@ trivial_subqueryscan(SubqueryScan *plan) static Plan * clean_up_removed_plan_level(Plan *parent, Plan *child) { - /* We have to be sure we don't lose any initplans */ + /* + * We have to be sure we don't lose any initplans, so move any that were + * attached to the parent plan to the child. If we do move any, the child + * is no longer parallel-safe. + */ + if (parent->initPlan) + child->parallel_safe = false; + + /* + * Attach plans this way so that parent's initplans are processed before + * any pre-existing initplans of the child. Probably doesn't matter, but + * let's preserve the ordering just in case. + */ child->initPlan = list_concat(parent->initPlan, child->initPlan); |