@@ -1637,14 +1637,16 @@ set_append_references(PlannerInfo *root,
1637
1637
* See if it's safe to get rid of the Append entirely. For this to be
1638
1638
* safe, there must be only one child plan and that child plan's parallel
1639
1639
* awareness must match that of the Append's. The reason for the latter
1640
- * is that the if the Append is parallel aware and the child is not then
1641
- * the calling plan may execute the non-parallel aware child multiple
1642
- * times.
1640
+ * is that if the Append is parallel aware and the child is not, then the
1641
+ * calling plan may execute the non-parallel aware child multiple times.
1643
1642
*/
1644
- if (list_length (aplan -> appendplans ) == 1 &&
1645
- ((Plan * ) linitial (aplan -> appendplans ))-> parallel_aware == aplan -> plan .parallel_aware )
1646
- return clean_up_removed_plan_level ((Plan * ) aplan ,
1647
- (Plan * ) linitial (aplan -> appendplans ));
1643
+ if (list_length (aplan -> appendplans ) == 1 )
1644
+ {
1645
+ Plan * p = (Plan * ) linitial (aplan -> appendplans );
1646
+
1647
+ if (p -> parallel_aware == aplan -> plan .parallel_aware )
1648
+ return clean_up_removed_plan_level ((Plan * ) aplan , p );
1649
+ }
1648
1650
1649
1651
/*
1650
1652
* Otherwise, clean up the Append as needed. It's okay to do this after
@@ -1709,14 +1711,17 @@ set_mergeappend_references(PlannerInfo *root,
1709
1711
* See if it's safe to get rid of the MergeAppend entirely. For this to
1710
1712
* be safe, there must be only one child plan and that child plan's
1711
1713
* parallel awareness must match that of the MergeAppend's. The reason
1712
- * for the latter is that the if the MergeAppend is parallel aware and the
1714
+ * for the latter is that if the MergeAppend is parallel aware and the
1713
1715
* child is not then the calling plan may execute the non-parallel aware
1714
1716
* child multiple times.
1715
1717
*/
1716
- if (list_length (mplan -> mergeplans ) == 1 &&
1717
- ((Plan * ) linitial (mplan -> mergeplans ))-> parallel_aware == mplan -> plan .parallel_aware )
1718
- return clean_up_removed_plan_level ((Plan * ) mplan ,
1719
- (Plan * ) linitial (mplan -> mergeplans ));
1718
+ if (list_length (mplan -> mergeplans ) == 1 )
1719
+ {
1720
+ Plan * p = (Plan * ) linitial (mplan -> mergeplans );
1721
+
1722
+ if (p -> parallel_aware == mplan -> plan .parallel_aware )
1723
+ return clean_up_removed_plan_level ((Plan * ) mplan , p );
1724
+ }
1720
1725
1721
1726
/*
1722
1727
* Otherwise, clean up the MergeAppend as needed. It's okay to do this
0 commit comments