pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix PG 17 [NOT] NULL optimization bug for domains
Date: Tue, 08 Apr 2025 01:34:07 +0000
Message-ID: <E1u1xqp-003DV2-1h@gemulon.postgresql.org> (raw)

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+.

Reported-by: Jan Behrens

Diagnosed-by: Tom Lane

Discussion: https://postgr.es/m/Z37p0paENWWUarj-@momjian.us

Backpatch-through: 17

Branch
------
REL_17_STABLE

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

Modified Files
--------------
doc/src/sgml/ref/create_domain.sgml    |  3 ++-
src/backend/optimizer/plan/initsplan.c | 14 ++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1u1xqp-003DV2-1h@gemulon.postgresql.org>
Permalink:  ../E1u1xqp-003DV2-1h@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1u1xqp-003DV2-1h@gemulon.postgresql.org

 · 

reply

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
  Subject: Re: pgsql: Fix PG 17 [NOT] NULL optimization bug for domains
  In-Reply-To: <E1u1xqp-003DV2-1h@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