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: Avoid mislabeling of lateral references, redux.
Date: Sat, 30 Nov 2024 17:42:36 +0000
Message-ID: <E1tHRUJ-000L6g-Ey@gemulon.postgresql.org> (raw)

Avoid mislabeling of lateral references, redux.

As I'd feared, commit 5c9d8636d was still a few bricks shy of a load.
We can't just leave pulled-up lateral-reference Vars with no new
nullingrels: we have to carefully compute what subset of the
to-be-replaced Var's nullingrels apply to them, else we still get
"wrong varnullingrels" errors.  This is a bit tedious, but it looks
like we can use the nullingrel data this patch computes for other
purposes, enabling better optimization.  We don't want to inject
unnecessary plan changes into stable branches though, so leave that
idea for a later HEAD-only patch.

Patch by me, but thanks to Richard Guo for devising a test case that
broke 5c9d8636d, and for preliminary investigation about how to fix
it.  As before, back-patch to v16.

Discussion: https://postgr.es/m/E1tGn4j-0003zi-MP@gemulon.postgresql.org

Branch
------
master

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

Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c | 171 +++++++++++++++++++++++++++++-
src/test/regress/expected/subselect.out   |  51 +++++++++
src/test/regress/sql/subselect.sql        |  15 +++
src/tools/pgindent/typedefs.list          |   1 +
4 files changed, 233 insertions(+), 5 deletions(-)



view thread (15+ messages)  latest in thread

Message-ID: <E1tHRUJ-000L6g-Ey@gemulon.postgresql.org>
Permalink:  ../E1tHRUJ-000L6g-Ey@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1tHRUJ-000L6g-Ey@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: Avoid mislabeling of lateral references, redux.
  In-Reply-To: <E1tHRUJ-000L6g-Ey@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