pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix miscomputation of direct_lateral_relids for join relations.
Date: Mon, 30 Nov 2020 17:23:18 +0000
Message-ID: <E1kjmtS-0003rS-FF@gemulon.postgresql.org> (raw)

Fix miscomputation of direct_lateral_relids for join relations.

If a PlaceHolderVar is to be evaluated at a join relation, but
its value is only needed there and not at higher levels, we neglected
to update the joinrel's direct_lateral_relids to include the PHV's
source rel.  This causes problems because join_is_legal() then won't
allow joining the joinrel to the PHV's source rel at all, leading
to "failed to build any N-way joins" planner failures.

Per report from Andreas Seltenreich.  Back-patch to 9.5
where the problem originated.

Discussion: https://postgr.es/m/87blfgqa4t.fsf@aurora.ydns.eu

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8c5da2d512e3e00c55f3f8fb7af12dfabc5b9284

Modified Files
--------------
src/backend/optimizer/util/placeholder.c | 39 +++++++++++++------
src/test/regress/expected/join.out       | 64 ++++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql            | 27 ++++++++++++++
3 files changed, 118 insertions(+), 12 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1kjmtS-0003rS-FF@gemulon.postgresql.org>
Permalink:  ../E1kjmtS-0003rS-FF@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kjmtS-0003rS-FF@gemulon.postgresql.org

 · 

reply

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 miscomputation of direct_lateral_relids for join relations.
  In-Reply-To: <E1kjmtS-0003rS-FF@gemulon.postgresql.org>
  References: <E1kjmtS-0003rS-FF@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