aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/planner.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2015-03-11 23:18:03 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2015-03-11 23:18:03 -0400
commitf4abd0241de20d5d6a79b84992b9e88603d44134 (patch)
tree7b43a57a988932798cebdf16375f4aab860c52c0 /src/backend/optimizer/plan/planner.c
parentb746d0c32d4fe749c8d39ccb09d8f0fb38bcc197 (diff)
downloadpostgresql-f4abd0241de20d5d6a79b84992b9e88603d44134.tar.gz
postgresql-f4abd0241de20d5d6a79b84992b9e88603d44134.zip
Support flattening of empty-FROM subqueries and one-row VALUES tables.
We can't handle this in the general case due to limitations of the planner's data representations; but we can allow it in many useful cases, by being careful to flatten only when we are pulling a single-row subquery up into a FROM (or, equivalently, inner JOIN) node that will still have at least one remaining relation child. Per discussion of an example from Kyotaro Horiguchi.
Diffstat (limited to 'src/backend/optimizer/plan/planner.c')
-rw-r--r--src/backend/optimizer/plan/planner.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index b02a1079ae4..88b91f1b205 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -352,8 +352,7 @@ subquery_planner(PlannerGlobal *glob, Query *parse,
* Check to see if any subqueries in the jointree can be merged into this
* query.
*/
- parse->jointree = (FromExpr *)
- pull_up_subqueries(root, (Node *) parse->jointree);
+ pull_up_subqueries(root);
/*
* If this is a simple UNION ALL query, flatten it into an appendrel. We