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 oversight in outer join removal.
Date: Thu, 08 Jun 2023 21:10:10 +0000
Message-ID: <E1q7MtW-000olo-6I@gemulon.postgresql.org> (raw)

Fix oversight in outer join removal.

A placeholder that references the outer join's relid in ph_eval_at
is logically "above" the join, and therefore we can't remove its
PlaceHolderInfo: it might still be used somewhere in the query.

This was not an issue pre-v16 because we failed to remove the join
at all in such cases.  The new outer-join-aware-Var infrastructure
permits deducing that it's okay to remove the join, but then we
have to clean up correctly afterwards.

Report and fix by Richard Guo

Discussion: https://postgr.es/m/CAMbWs4_tuVn9EwwMcggGiZJWWstdXX_ci8FeEU17vs+4nLgw3w@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9a2dbc614e6e47da3c49daacec106da32eba9467

Modified Files
--------------
src/backend/optimizer/plan/analyzejoins.c |  3 +-
src/test/regress/expected/join.out        | 57 +++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql             | 34 ++++++++++++++++++
3 files changed, 93 insertions(+), 1 deletion(-)



Message-ID: <E1q7MtW-000olo-6I@gemulon.postgresql.org>
Permalink:  ../E1q7MtW-000olo-6I@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1q7MtW-000olo-6I@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: Fix oversight in outer join removal.
  In-Reply-To: <E1q7MtW-000olo-6I@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