Re: NOT NULL NOT ENFORCED
Álvaro Herrera <alvherre@kurilemu.de>
From: Álvaro Herrera <alvherre@kurilemu.de>
To: jian he <jian.universality@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-09-25T09:46:28Z
Lists: pgsql-hackers
On 2025-Sep-24, jian he wrote: > currently NOT VALID NOT NULL dumped > constraint separately, NOT NULL NOT ENFORCED constraints can also be dumped > separately. > > CREATE TABLE tx3 (x int not null not enforced); > > can be dumped as: > > CREATE TABLE public.tx3 (x integer); > ALTER TABLE public.tx3 ADD CONSTRAINT tx3_x_not_null NOT NULL x NOT ENFORCED; > --------------- > note: currently not enforced check constraint is dumped separately. Hmm, I wonder what's the reason for this. Seems quite useless. Why wouldn't we dump unenforced constraint together with the table? The case is different from invalid constraints, which have to be created after data is loaded. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
Commits
-
Fix CREATE TABLE LIKE with not-valid check constraint
- 33eec809402b 19 (unreleased) landed
- 21fdc37d219a 18.0 landed
-
Add support for NOT ENFORCED in CHECK constraints
- ca87c415e2fc 18.0 cited