Re: Wrong result for whole-row IS NOT NULL with dropped columns

From: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>
To: João Rito <joaovictor(dot)rito(at)gmail(dot)com>
Cc: Sho Ito <i(dot)sho(dot)0628(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Wrong result for whole-row IS NOT NULL with dropped columns
Date: 2026-11-12 13:05:36
Message-ID: a612de68-081e-449f-a1f9-d97485f8948e@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/11/26 19:28, João Rito wrote:
> Hi Matheus,
>
> Thanks for v2 and for the back-branch patches.
>
> I read the patches. v2 covers the points I raised:
> - The WHERE case is now in generated_virtual.sql (gtest20e), with the
> EXPLAIN of the Filter and the count(*) result, plus the CHECK
> constraint case.
> - The ALTER TYPE ... DROP ATTRIBUTE case and the stored view case are
> in rowtypes.sql, with the EXPLAIN output showing "(x IS NOT NULL) AND
> (z IS NOT NULL)".
> - The back-branch patches match what you describe: REL_18 without
> expr_is_nonnullable(), REL_17 and older with TupleDescAttr() and only
> the rowtypes.sql tests, and REL_14 with regular tables instead of temp
> tables.
>
> I also tested them:
> - v2 applies to current master (8d87367b39e), and make check passes
> (all 243 tests).
> - With the v2 tests but the old clauses.c, generated_virtual and
> rowtypes fail (2 of 243), so the new tests catch the bug.
> - The WHERE case from the report (count(*) ... WHERE t IS NOT NULL)
> returns 0 on master and 2 with v2.
> - The back-branch patches apply and make check passes on REL_18_STABLE
> (235 tests), REL_17_STABLE (229) and REL_14_STABLE (220). I did not
> test REL_15 and REL_16.
>
> I have no remaining concerns about the code. One small optional idea:
> the view test only checks the view that has the IS NOT NULL inside it.
> It could also check a view that stores only the ROW(...)::type and
> applies IS NOT NULL outside it, but I think the current test is
> enough.
>

Thank you Joao for testing the patch!

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jakub Wartak 2026-11-12 13:09:38 Re: amcheck: add index-all-keys-match verification for B-Tree
Previous Message Tomas Vondra 2026-11-12 12:57:38 Re: reconsider_full_join_clause fails to consider if COALESCE() arguments are NULL-preserving