pgsql: Fix PG 17 [NOT] NULL optimization bug for domains

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix PG 17 [NOT] NULL optimization bug for domains
Date: 2025-04-08 01:34:07
Message-ID: E1u1xqp-003DV2-1h@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2025-04-08 04:23:16 pgsql: Stabilize 035_standby_logical_decoding.pl.
Previous Message Michael Paquier 2025-04-07 22:59:18 pgsql: Flush the IO statistics of active WAL senders more frequently