| 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-03-03 08:03:46 |
| Message-ID: | CACJufxEBvceJ4Ju=7_LtfcL5ekuXK=AWgOB1vAN_svKRYetgyg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Feb 23, 2026 at 11:50 PM Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:
>
> But what is NOT VALID NOT ENFORCED? Unless I'm confused, a constraint
> can be in one of three cases,
>
> 1. the normal one (valid and enforced), which is dumped together with
> the table,
> 2. the NOT ENFORCED one, for which there's no validity marking (these
> are all in practice invalid, but we don't spell that out because it's
> pointless to do so), which I argue should also be dumped together
> with the table,
> 3. NOT VALID but enforced, which is dumped separately, because trying to
> dump it together with the table just won't work.
>
> I understand that you want to treat 2 the same as 3, because it saves a
> dozen of pg_dump lines of code. I think it's more user friendly to
> treat 2 the same as 1, and that the dozen lines of code are worth it.
>
Hi.
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....
| Attachment | Content-Type | Size |
|---|---|---|
| v4-0001-NOT-NULL-NOT-ENFORCED.patch | text/x-patch | 84.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2026-03-03 08:04:53 | Re: DOC: fixes multiple errors in alter table doc |
| Previous Message | Alexander Lakhin | 2026-03-03 08:00:00 | Re: BUG: Former primary node might stuck when started as a standby |