pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Amit Langote <amitlangote09@gmail.com>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: cataloguing NOT NULL constraints
Date: Wed, 14 Sep 2022 22:03:50 +0200
Message-ID: <bac841ed-b86d-e3c2-030d-02a3db067307@enterprisedb.com> (raw)
In-Reply-To: <20220909175813.vu5kd2m67mrrqkjv@alvherre.pgsql>
References: <20220909175813.vu5kd2m67mrrqkjv@alvherre.pgsql>

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.






view thread (196+ messages)  latest in thread

Message-ID: <bac841ed-b86d-e3c2-030d-02a3db067307@enterprisedb.com>
Permalink:  ../bac841ed-b86d-e3c2-030d-02a3db067307@enterprisedb.com/
Also on:    postgresql.org/message-id/bac841ed-b86d-e3c2-030d-02a3db067307@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@enterprisedb.com, alvherre@alvh.no-ip.org, amitlangote09@gmail.com, laurenz.albe@cybertec.at, pgsql-hackers@lists.postgresql.org
  Subject: Re: cataloguing NOT NULL constraints
  In-Reply-To: <bac841ed-b86d-e3c2-030d-02a3db067307@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox