Re: NOT NULL NOT ENFORCED

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NOT NULL NOT ENFORCED
Date: 2026-08-06 04:49:27
Message-ID: CACJufxHvGs7RR97-vN61Y2mZaF2YEgpHScw5SFG=TghFQAN9gA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 3, 2026 at 4:03 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
> It turns out that the change for NOT ENFORCED NOT NULL is pg_dump.c is
> not complicated.
>
> CREATE TABLE ne_nn_tbl (x int, CONSTRAINT nn NOT NULL x NOT ENFORCED);
> Now the pg_dump output is
>
> CREATE TABLE public.ne_nn_tbl (
> x integer CONSTRAINT nn NOT NULL NOT ENFORCED
> );
>
> but the 002_pg_dump.pl is failing....
>

Hi.
v5 is attached.
Now the 002_pg_dump.pl is written by Claude.
Claude also found that v4 failed completely for ALTER TABLE
MERGE/SPLIT PARTITIONS.

I am aware of the complexity of
https://git.postgresql.org/cgit/postgresql.git/commit/?id=0cd17fdd3c000f6e64e79da0fea5e65dc9f562df
However, we currently do not support altering a NOT NULL constraint's
enforceability, so we are fine for now.
But I hope the new tests in src/test/regress/sql/inherit.sql cover all
the corner cases.

Attachment Content-Type Size
v5-0001-NOT-NULL-NOT-ENFORCED.patch text/x-patch 92.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-08-06 04:52:40 Re: Introduce XID age based replication slot invalidation
Previous Message Chao Li 2026-08-06 04:44:38 Re: Add a hook for handling logical decoding messages on subscribers.