| From: | Fujii Masao <fujii(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Prevent setting NO INHERIT on partitioned NOT NULL constraints |
| Date: | 2026-05-22 15:01:37 |
| Message-ID: | E1wQRNZ-000euL-10@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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 <andreas(at)proxel(dot)se>
Reviewed-by: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/ecc985ad-6ec1-4094-a315-317943ca5f3f@proxel.se
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(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Fujii Masao | 2026-05-22 15:02:00 | pgsql: Prevent setting NO INHERIT on partitioned NOT NULL constraints |
| Previous Message | Alexander Korotkov | 2026-05-20 20:24:24 | pgsql: Revert "Reject degenerate SPLIT PARTITION with DEFAULT partition |