From: Bruce Momjian <bruce@momjian.us>
To: pgsql-committers@lists.postgresql.org
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: pgsql: Fix PG 17 [NOT] NULL optimization bug for domains
Date: Tue, 8 Apr 2025 09:36:47 -0400
Message-ID: <Z_Umb38nfDqbqw5w@momjian.us> (raw)
In-Reply-To: <E1u1xqp-003DV2-1h@gemulon.postgresql.org>
References: <E1u1xqp-003DV2-1h@gemulon.postgresql.org>
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.
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: bruce@momjian.us, pgsql-committers@lists.postgresql.org, tgl@sss.pgh.pa.us
Subject: Re: pgsql: Fix PG 17 [NOT] NULL optimization bug for domains
In-Reply-To: <Z_Umb38nfDqbqw5w@momjian.us>
* 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