pgsql: Remove over-optimistic Assert.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove over-optimistic Assert.
Date: 2023-01-31 16:58:10
Message-ID: E1pMtxR-000uZR-Dg@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Remove over-optimistic Assert.

In commit 2489d76c4, I'd thought it'd be safe to assert that a
PlaceHolderVar appearing in a scan-level expression has empty
nullingrels. However this is not so, as when we determine that a
join relation is certainly empty we'll put its targetlist into a
Result-with-constant-false-qual node, and nothing is done to adjust
the nullingrels of the Vars or PHVs therein. (Arguably, a Result
used in this way isn't really a scan-level node, but it certainly
isn't an upper node either ...)

It's not clear this is worth any close analysis, so let's just
take out the faulty Assert.

Per report from Robins Tharakan. I added a test case based on
his example, just in case somebody tries to tighten this up.

Discussion: https://postgr.es/m/CAEP4nAz7Enq3+DEthGG7j27DpuwSRZnW0Nh6jtNh75yErQ_nbA@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/optimizer/plan/setrefs.c | 2 +-
src/test/regress/expected/join.out | 14 ++++++++++++++
src/test/regress/sql/join.sql | 8 ++++++++
3 files changed, 23 insertions(+), 1 deletion(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2023-01-31 16:59:54 Re: pgsql: Make Vars be outer-join-aware.
Previous Message Tom Lane 2023-01-31 14:50:28 Re: pgsql: Make Vars be outer-join-aware.

Browse pgsql-hackers by date

  From Date Subject
Next Message Dagfinn Ilmari Mannsåker 2023-01-31 17:07:06 Clarify deleting comments and security labels in synopsis
Previous Message Laurenz Albe 2023-01-31 16:35:12 Re: Allow tailoring of ICU locales with custom rules