aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/allpaths.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/path/allpaths.c')
-rw-r--r--src/backend/optimizer/path/allpaths.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index cf6a9a9f82a..6deb2cf0c9c 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -608,6 +608,15 @@ set_rel_consider_parallel(PlannerInfo *root, RelOptInfo *rel,
if (has_parallel_hazard((Node *) rel->baserestrictinfo, false))
return;
+ /*
+ * If the relation's outputs are not parallel-safe, we must give up.
+ * In the common case where the relation only outputs Vars, this check is
+ * very cheap; otherwise, we have to do more work.
+ */
+ if (rel->reltarget_has_non_vars &&
+ has_parallel_hazard((Node *) rel->reltarget->exprs, false))
+ return;
+
/* We have a winner. */
rel->consider_parallel = true;
}
@@ -971,6 +980,7 @@ set_append_rel_size(PlannerInfo *root, RelOptInfo *rel,
adjust_appendrel_attrs(root,
(Node *) rel->reltarget->exprs,
appinfo);
+ childrel->reltarget_has_non_vars = rel->reltarget_has_non_vars;
/*
* We have to make child entries in the EquivalenceClass data