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.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/f4abd0241de20d5d6a79b84992b9e88603d44134
Modified Files
--------------
src/backend/nodes/outfuncs.c | 1 +
src/backend/optimizer/plan/planner.c | 3 +-
src/backend/optimizer/prep/prepjointree.c | 452 +++++++++++++++++++++++++----
src/include/nodes/relation.h | 1 +
src/include/optimizer/prep.h | 2 +-
src/test/regress/expected/join.out | 28 +-
src/test/regress/expected/rangefuncs.out | 24 +-
src/test/regress/sql/join.sql | 13 +-
src/test/regress/sql/rangefuncs.sql | 13 +-
9 files changed, 466 insertions(+), 71 deletions(-)