Re: pgsql: Fix PG 17 [NOT] NULL optimization bug for domains - Mailing list pgsql-committers

From Bruce Momjian
Subject Re: pgsql: Fix PG 17 [NOT] NULL optimization bug for domains
Date
Msg-id Z_Umb38nfDqbqw5w@momjian.us
Whole thread Raw
In response to pgsql: Fix PG 17 [NOT] NULL optimization bug for domains  (Bruce Momjian <bruce@momjian.us>)
List pgsql-committers
On Tue, Apr  8, 2025 at 01:34:07AM +0000, Bruce Momjian wrote:
> Fix PG 17 [NOT] NULL optimization bug for domains
> 
> A PG 17 optimization allowed columns with NOT NULL constraints to skip
> table scans for IS NULL queries, and to skip IS NOT NULL checks for IS
> NOT NULL queries.  This didn't work for domain types, since domain types
> don't follow the IS NULL/IS NOT NULL constraint logic.  To fix, disable
> this optimization for domains for PG 17+.
>
> Discussion:  https://postgr.es/m/Z37p0paENWWUarj-@momjian.us

Ugh, I knew there was something odd about the commit message I wrote
above, but I couldn't put my figure on it until this morning.  The
problem above is not "domains" but row types;  the bug report showed it
as an issue with row types used for domains, but it can happen with
columns which are row types too.  The doc adjustment was for domains,
and that confused me.

Tom, can you remember this in the 17.5 release notes?  Thanks.  The
commit should have been:

    Fix PG 17 [NOT] NULL optimization bug for row types

    A PG 17 optimization allowed columns with NOT NULL constraints
    to skip table scans for IS NULL queries, and to skip IS NOT NULL
    checks for IS NOT NULL queries.  This didn't work for row types,
    since row types don't follow the IS NULL/IS NOT NULL constraint
    logic.    To fix, disable this optimization for row types for PG 17+.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Do not let urgent matters crowd out time for investment in the future.



pgsql-committers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: pgsql: ci: Add MBUILD_TARGET for NetBSD and OpenBSD
Next
From: Tom Lane
Date:
Subject: Re: pgsql: Add support for basic NUMA awareness