summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2015-03-12 03:18:03 +0000
committerTom Lane2015-03-12 03:18:03 +0000
commitf4abd0241de20d5d6a79b84992b9e88603d44134 (patch)
tree7b43a57a988932798cebdf16375f4aab860c52c0 /src/include
parentb746d0c32d4fe749c8d39ccb09d8f0fb38bcc197 (diff)
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/include')
-rw-r--r--src/include/nodes/relation.h1
-rw-r--r--src/include/optimizer/prep.h2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index e6dd4e8515..334cf51976 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -244,6 +244,7 @@ typedef struct PlannerInfo
* inheritance child rel */
bool hasJoinRTEs; /* true if any RTEs are RTE_JOIN kind */
bool hasLateralRTEs; /* true if any RTEs are marked LATERAL */
+ bool hasDeletedRTEs; /* true if any RTE was deleted from jointree */
bool hasHavingQual; /* true if havingQual was non-null */
bool hasPseudoConstantQuals; /* true if any RestrictInfo has
* pseudoconstant = true */
diff --git a/src/include/optimizer/prep.h b/src/include/optimizer/prep.h
index 385f4a866a..05e46c5b78 100644
--- a/src/include/optimizer/prep.h
+++ b/src/include/optimizer/prep.h
@@ -23,7 +23,7 @@
*/
extern void pull_up_sublinks(PlannerInfo *root);
extern void inline_set_returning_functions(PlannerInfo *root);
-extern Node *pull_up_subqueries(PlannerInfo *root, Node *jtnode);
+extern void pull_up_subqueries(PlannerInfo *root);
extern void flatten_simple_union_all(PlannerInfo *root);
extern void reduce_outer_joins(PlannerInfo *root);
extern Relids get_relids_in_jointree(Node *jtnode, bool include_joins);