aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/util/placeholder.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2016-06-09 12:40:23 -0400
committerRobert Haas <rhaas@postgresql.org>2016-06-09 12:43:36 -0400
commitb12fd41c695b43c76b0a9a4d19ba43b05536440c (patch)
tree966a7ca8b9c268b70f38257a56aeccaa25fd82b2 /src/backend/optimizer/util/placeholder.c
parente7bcd983f56136a9580076b60d5c19eb2fd83301 (diff)
downloadpostgresql-b12fd41c695b43c76b0a9a4d19ba43b05536440c.tar.gz
postgresql-b12fd41c695b43c76b0a9a4d19ba43b05536440c.zip
Don't generate parallel paths for rels with parallel-restricted outputs.
Such paths are unsafe. To make it cheaper to detect when this case applies, track whether a relation's default PathTarget contains any non-Vars. In most cases, the answer will be no, which enables us to determine cheaply that the target list for a proposed path is parallel-safe. However, subquery pull-up can create cases that require us to inspect the target list more carefully. Amit Kapila, reviewed by me.
Diffstat (limited to 'src/backend/optimizer/util/placeholder.c')
-rw-r--r--src/backend/optimizer/util/placeholder.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/optimizer/util/placeholder.c b/src/backend/optimizer/util/placeholder.c
index b210914b853..5b85a4ddadc 100644
--- a/src/backend/optimizer/util/placeholder.c
+++ b/src/backend/optimizer/util/placeholder.c
@@ -393,6 +393,7 @@ add_placeholders_to_base_rels(PlannerInfo *root)
rel->reltarget->exprs = lappend(rel->reltarget->exprs,
copyObject(phinfo->ph_var));
+ rel->reltarget_has_non_vars = true;
/* reltarget's cost and width fields will be updated later */
}
}
@@ -427,6 +428,7 @@ add_placeholders_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel,
/* Yup, add it to the output */
joinrel->reltarget->exprs = lappend(joinrel->reltarget->exprs,
phinfo->ph_var);
+ joinrel->reltarget_has_non_vars = true;
joinrel->reltarget->width += phinfo->ph_width;
/*