Re: NOT NULL NOT ENFORCED - Mailing list pgsql-hackers

From Álvaro Herrera
Subject Re: NOT NULL NOT ENFORCED
Date
Msg-id 202509250924.hyz33zhcwl7d@alvherre.pgsql
Whole thread Raw
In response to Re: NOT NULL NOT ENFORCED  (jian he <jian.universality@gmail.com>)
List 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/



pgsql-hackers by date:

Previous
From: Arseniy Mukhin
Date:
Subject: Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue
Next
From: Daniel Gustafsson
Date:
Subject: Re: Fix incorrect function comment of stringToNodeInternal