From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix an oversight in checking whether a join with LATERAL refs is |
Date: | 2015-07-31 23:26:48 |
Message-ID: | E1ZLJhQ-0007hd-W9@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix an oversight in checking whether a join with LATERAL refs is legal.
In many cases, we can implement a semijoin as a plain innerjoin by first
passing the righthand-side relation through a unique-ification step.
However, one of the cases where this does NOT work is where the RHS has
a LATERAL reference to the LHS; that makes the RHS dependent on the LHS
so that unique-ification is meaningless. joinpath.c understood this,
and so would not generate any join paths of this kind ... but join_is_legal
neglected to check for the case, so it would think that we could do it.
The upshot would be a "could not devise a query plan for the given query"
failure once we had failed to generate any join paths at all for the bogus
join pair.
Back-patch to 9.3 where LATERAL was added.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/a6492ff8970b06b9e27cc314c7d1aa574fcc7b04
Modified Files
--------------
src/backend/optimizer/path/joinrels.c | 8 ++++++--
src/test/regress/expected/join.out | 35 +++++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql | 13 ++++++++++++
3 files changed, 54 insertions(+), 2 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-07-31 23:26:49 | pgsql: Fix an oversight in checking whether a join with LATERAL refs is |
Previous Message | Noah Misch | 2015-07-31 00:51:30 | pgsql: Consolidate makefile code for setting top_srcdir, srcdir and VPA |