pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Fix PG 17 [NOT] NULL optimization bug for domains
3+ messages / 1 participants
[nested] [flat]
* pgsql: Fix PG 17 [NOT] NULL optimization bug for domains
@ 2025-04-08 01:34 Bruce Momjian <bruce@momjian.us>
0 siblings, 0 replies; 3+ messages in thread
From: Bruce Momjian @ 2025-04-08 01:34 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
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
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/46b4ba533cee9f64a60714d91607e74362abf67f
Modified Files
--------------
doc/src/sgml/ref/create_domain.sgml | 3 ++-
src/backend/optimizer/plan/initsplan.c | 14 ++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix PG 17 [NOT] NULL optimization bug for domains
@ 2025-04-08 01:34 Bruce Momjian <bruce@momjian.us>
2025-04-08 13:36 ` Re: pgsql: Fix PG 17 [NOT] NULL optimization bug for domains Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 3+ messages in thread
From: Bruce Momjian @ 2025-04-08 01:34 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
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(-)
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pgsql: Fix PG 17 [NOT] NULL optimization bug for domains
2025-04-08 01:34 pgsql: Fix PG 17 [NOT] NULL optimization bug for domains Bruce Momjian <bruce@momjian.us>
@ 2025-04-08 13:36 ` Bruce Momjian <bruce@momjian.us>
0 siblings, 0 replies; 3+ messages in thread
From: Bruce Momjian @ 2025-04-08 13:36 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org; +Cc: Tom Lane <tgl@sss.pgh.pa.us>
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2025-04-08 13:36 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-04-08 01:34 pgsql: Fix PG 17 [NOT] NULL optimization bug for domains Bruce Momjian <bruce@momjian.us>
2025-04-08 01:34 pgsql: Fix PG 17 [NOT] NULL optimization bug for domains Bruce Momjian <bruce@momjian.us>
2025-04-08 13:36 ` Bruce Momjian <bruce@momjian.us>
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