Re: NOT NULL NOT ENFORCED

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NOT NULL NOT ENFORCED
Date: 2025-09-25 09:46:28
Message-ID: 202509250924.hyz33zhcwl7d@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
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/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-09-25 09:54:30 Re: Fix incorrect function comment of stringToNodeInternal
Previous Message Arseniy Mukhin 2025-09-25 09:43:34 Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue