From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix oversight in flattening of subqueries with empty FROM.
Date: Sun, 26 Jul 2015 21:44:37 +0000
Message-ID: <E1ZJTin-00025n-Np@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Fix oversight in flattening of subqueries with empty FROM.
I missed a restriction that commit f4abd0241de20d5d6a79b84992b9e88603d44134
should have enforced: we can't pull up an empty-FROM subquery if it's under
an outer join, because then we'd need to wrap its output columns in
PlaceHolderVars. As the code currently stands, the PHVs end up with empty
relid sets, which doesn't work (and is correctly caught by an Assert).
It's possible that this could be fixed by assigning the PHVs the relid
sets of the parent FromExpr/JoinExpr, but getting that to work is more
complication than I care to add right now; indeed it's likely that
we'll never bother, since pulling up empty-FROM subqueries is a rather
marginal optimization anyway.
Per report from Andreas Seltenreich. Back-patch to 9.5 where the faulty
code was added.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/fca8e59c1c582030dd7a3c870e1c3c70e8a193aa
Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c | 52 +++++++++++++++++++----------
src/test/regress/expected/join.out | 34 +++++++++++++++++++
src/test/regress/sql/join.sql | 13 ++++++++
3 files changed, 81 insertions(+), 18 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Fix oversight in flattening of subqueries with empty FROM.
In-Reply-To: <E1ZJTin-00025n-Np@gemulon.postgresql.org>
References: <E1ZJTin-00025n-Np@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox