mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
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.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user