From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix computation of varnullingrels when const-folding field selec
Date: Thu, 09 Nov 2023 20:46:24 +0000
Message-ID: <E1r1Bux-004hOx-If@gemulon.postgresql.org> (raw)
Fix computation of varnullingrels when const-folding field selection.
We can simplify FieldSelect on a whole-row Var into a plain Var
for the selected field. However, we should copy the whole-row Var's
varnullingrels when we do so, because the new Var is clearly nullable
by exactly the same rels as the original. Failure to do this led to
errors like "wrong varnullingrels (b) (expected (b 3)) for Var 2/2".
Richard Guo, per bug #18184 from Marian Krucina. Back-patch to
v16 where varnullingrels was introduced.
Discussion: https://postgr.es/m/18184-5868dd258782058e@postgresql.org
Branch
------
REL_16_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/6bf2efb38285626a9de3004dd1c23d9a85453372
Modified Files
--------------
src/backend/optimizer/util/clauses.c | 19 +++++++++++++------
src/test/regress/expected/join.out | 26 ++++++++++++++++++++++++++
src/test/regress/sql/join.sql | 12 ++++++++++++
3 files changed, 51 insertions(+), 6 deletions(-)
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 computation of varnullingrels when const-folding field selec
In-Reply-To: <E1r1Bux-004hOx-If@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