Re: cataloguing NOT NULL constraints

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: cataloguing NOT NULL constraints
Date: 2022-09-14 20:03:50
Message-ID: bac841ed-b86d-e3c2-030d-02a3db067307@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09.09.22 19:58, Alvaro Herrera wrote:
> There were a lot more problems in that submission than I at first
> realized, and I had to rewrite a lot of code in order to fix them. I
> have fixed all the user-visible problems I found in this version, and
> reviewed the tests results more carefully so I am now more confident
> that behaviourally it's doing the right thing; but

Reading through the SQL standard again, I think this patch goes a bit
too far in folding NOT NULL and CHECK constraints together. The spec
says that you need to remember whether a column was defined as NOT NULL,
and that the commands DROP NOT NULL and SET NOT NULL only affect
constraints defined in that way. In this implementation, a constraint
defined as NOT NULL is converted to a CHECK (x IS NOT NULL) constraint
and the original definition is forgotten.

Besides that, I think that users are not going to like that pg_dump
rewrites their NOT NULL constraints into CHECK table constraints.

I suspect that this needs a separate contype for NOT NULL constraints
that is separate from CONSTRAINT_CHECK.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-09-14 20:07:11 Re: archive modules
Previous Message Nathan Bossart 2022-09-14 20:03:05 Re: archive modules