public inbox for [email protected]  
help / color / mirror / Atom feed
pgsql: Prevent setting NO INHERIT on partitioned NOT NULL constraints
2+ messages / 1 participants
[nested] [flat]

* pgsql: Prevent setting NO INHERIT on partitioned NOT NULL constraints
@ 2026-05-22 15:01 Fujii Masao <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Fujii Masao @ 2026-05-22 15:01 UTC (permalink / raw)
  To: [email protected]

Prevent setting NO INHERIT on partitioned NOT NULL constraints

The documentation states that NOT NULL constraints on partitioned tables
are always inherited by all partitions, and therefore cannot be declared
NO INHERIT. While a check already existed to reject creating such
constraints with NO INHERIT, previously the same check was missing for
ALTER TABLE ... ALTER CONSTRAINT ... NO INHERIT.

This commit adds the missing check so that attempting to set NO INHERIT
on a partitioned NOT NULL constraint now fails.

Backpatch to v18, where ALTER TABLE ... ALTER CONSTRAINT ... [NO] INHERIT
was added.

Author: Andreas Karlsson <[email protected]>
Reviewed-by: Jim Jones <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 18

Branch
------
master

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

Modified Files
--------------
src/backend/commands/tablecmds.c          | 6 ++++++
src/test/regress/expected/constraints.out | 4 ++++
src/test/regress/sql/constraints.sql      | 3 +++
3 files changed, 13 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Prevent setting NO INHERIT on partitioned NOT NULL constraints
@ 2026-05-22 15:02 Fujii Masao <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Fujii Masao @ 2026-05-22 15:02 UTC (permalink / raw)
  To: [email protected]

Prevent setting NO INHERIT on partitioned NOT NULL constraints

The documentation states that NOT NULL constraints on partitioned tables
are always inherited by all partitions, and therefore cannot be declared
NO INHERIT. While a check already existed to reject creating such
constraints with NO INHERIT, previously the same check was missing for
ALTER TABLE ... ALTER CONSTRAINT ... NO INHERIT.

This commit adds the missing check so that attempting to set NO INHERIT
on a partitioned NOT NULL constraint now fails.

Backpatch to v18, where ALTER TABLE ... ALTER CONSTRAINT ... [NO] INHERIT
was added.

Author: Andreas Karlsson <[email protected]>
Reviewed-by: Jim Jones <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/41247cdf695b99eb4b6359ef3d6bdcfbad321847

Modified Files
--------------
src/backend/commands/tablecmds.c          | 6 ++++++
src/test/regress/expected/constraints.out | 4 ++++
src/test/regress/sql/constraints.sql      | 3 +++
3 files changed, 13 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-05-22 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-05-22 15:01 pgsql: Prevent setting NO INHERIT on partitioned NOT NULL constraints Fujii Masao <[email protected]>
2026-05-22 15:02 pgsql: Prevent setting NO INHERIT on partitioned NOT NULL constraints Fujii Masao <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox