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.