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: Defend against bogus parameterization of join input paths.
Date: Thu, 29 Jun 2023 16:13:03 +0000
Message-ID: <E1qEuGV-0013Gt-IU@gemulon.postgresql.org> (raw)

Defend against bogus parameterization of join input paths.

An outer join cannot be formed using an input path that is parameterized
by a value that is supposed to be nulled by the outer join.  This is
obviously nonsensical, and it could lead to a bad plan being selected;
although currently it seems that we'll hit various sanity-check
assertions first.

I think that such cases were formerly prevented by the delay_upper_joins
mechanism, but now that that's gone we need an explicit check.

(Perhaps we should avoid generating baserel paths that could
lead to this situation in the first place; but it seems like
having a defense at the join level would be a good idea anyway.)

Richard Guo and Tom Lane, per report from Jaime Casanova

Discussion: https://postgr.es/m/CAJKUy5g2uZRrUDZJ8p-=giwcSHVUn0c9nmdxPSY0jF0Ov8VoEA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a798660ebe3ff1feb310db13b957c5cda4c8c50d

Modified Files
--------------
src/backend/optimizer/path/joinpath.c | 33 +++++++++++++++++++++++++++++++++
src/test/regress/expected/join.out    | 23 +++++++++++++++++++++++
src/test/regress/sql/join.sql         | 22 ++++++++++++++++++++++
3 files changed, 78 insertions(+)



Message-ID: <E1qEuGV-0013Gt-IU@gemulon.postgresql.org>
Permalink:  ../E1qEuGV-0013Gt-IU@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qEuGV-0013Gt-IU@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Defend against bogus parameterization of join input paths.
  In-Reply-To: <E1qEuGV-0013Gt-IU@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