aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/setrefs.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2022-07-19 09:54:03 +0200
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2022-07-19 09:54:03 +0200
commit1679d57a550530ebef624738cc1b12647714fca6 (patch)
treeabe6d95800ff5ff37c6b08d8d2bfe663b02091d2 /src/backend/optimizer/plan/setrefs.c
parent4371d34f299bc261ba54f9bc3cdd1087f4336de3 (diff)
downloadpostgresql-1679d57a550530ebef624738cc1b12647714fca6.tar.gz
postgresql-1679d57a550530ebef624738cc1b12647714fca6.zip
Wrap overly long lines
Reported by Richard Guo. Reviewed-by: Richard Guo <guofenglinux@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAMbWs4-3ywL_tPHJKk-Vvzr-tBaR--b6XxGGm8Xe7vsG38AWog@mail.gmail.com
Diffstat (limited to 'src/backend/optimizer/plan/setrefs.c')
-rw-r--r--src/backend/optimizer/plan/setrefs.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c
index 9cef92cab24..707c1016c25 100644
--- a/src/backend/optimizer/plan/setrefs.c
+++ b/src/backend/optimizer/plan/setrefs.c
@@ -1637,14 +1637,16 @@ set_append_references(PlannerInfo *root,
* See if it's safe to get rid of the Append entirely. For this to be
* safe, there must be only one child plan and that child plan's parallel
* awareness must match that of the Append's. The reason for the latter
- * is that the if the Append is parallel aware and the child is not then
- * the calling plan may execute the non-parallel aware child multiple
- * times.
+ * is that if the Append is parallel aware and the child is not, then the
+ * calling plan may execute the non-parallel aware child multiple times.
*/
- if (list_length(aplan->appendplans) == 1 &&
- ((Plan *) linitial(aplan->appendplans))->parallel_aware == aplan->plan.parallel_aware)
- return clean_up_removed_plan_level((Plan *) aplan,
- (Plan *) linitial(aplan->appendplans));
+ if (list_length(aplan->appendplans) == 1)
+ {
+ Plan *p = (Plan *) linitial(aplan->appendplans);
+
+ if (p->parallel_aware == aplan->plan.parallel_aware)
+ return clean_up_removed_plan_level((Plan *) aplan, p);
+ }
/*
* Otherwise, clean up the Append as needed. It's okay to do this after
@@ -1709,14 +1711,17 @@ set_mergeappend_references(PlannerInfo *root,
* See if it's safe to get rid of the MergeAppend entirely. For this to
* be safe, there must be only one child plan and that child plan's
* parallel awareness must match that of the MergeAppend's. The reason
- * for the latter is that the if the MergeAppend is parallel aware and the
+ * for the latter is that if the MergeAppend is parallel aware and the
* child is not then the calling plan may execute the non-parallel aware
* child multiple times.
*/
- if (list_length(mplan->mergeplans) == 1 &&
- ((Plan *) linitial(mplan->mergeplans))->parallel_aware == mplan->plan.parallel_aware)
- return clean_up_removed_plan_level((Plan *) mplan,
- (Plan *) linitial(mplan->mergeplans));
+ if (list_length(mplan->mergeplans) == 1)
+ {
+ Plan *p = (Plan *) linitial(mplan->mergeplans);
+
+ if (p->parallel_aware == mplan->plan.parallel_aware)
+ return clean_up_removed_plan_level((Plan *) mplan, p);
+ }
/*
* Otherwise, clean up the MergeAppend as needed. It's okay to do this