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