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 "wrong varnullingrels" for subquery nestloop parameters.
Date: Mon, 12 Jun 2023 14:01:35 +0000
Message-ID: <E1q8i6x-001PwK-3z@gemulon.postgresql.org> (raw)

Fix "wrong varnullingrels" for subquery nestloop parameters.

If we apply outer join identity 3 when relation C is a subquery
having lateral references to relation B, then the lateral references
within C continue to bear the original syntactically-correct
varnullingrels marks, but that won't match what is available from
the outer side of the nestloop.  Compensate for that in
process_subquery_nestloop_params().  This is a slightly hacky fix,
but we certainly don't want to re-plan C in toto for each possible
outer join order, so there's not a lot of better alternatives.

Richard Guo and Tom Lane, per report from Markus Winand

Discussion: https://postgr.es/m/DFBB2D25-DE97-49CA-A60E-07C881EA59A7@winand.at

Branch
------
master

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

Modified Files
--------------
src/backend/optimizer/plan/setrefs.c     |  8 ++++---
src/backend/optimizer/util/paramassign.c | 36 +++++++++++++++++++++++++-------
src/test/regress/expected/join.out       | 18 ++++++++++++++++
src/test/regress/sql/join.sql            |  7 +++++++
4 files changed, 59 insertions(+), 10 deletions(-)



Message-ID: <E1q8i6x-001PwK-3z@gemulon.postgresql.org>
Permalink:  ../E1q8i6x-001PwK-3z@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1q8i6x-001PwK-3z@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 "wrong varnullingrels" for subquery nestloop parameters.
  In-Reply-To: <E1q8i6x-001PwK-3z@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