From: | Don Seiler <don(at)seiler(dot)us> |
---|---|
To: | Vik Fearing <vik(at)postgresfriends(dot)org> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Not Null Constraint vs Query Planning |
Date: | 2020-03-02 23:02:09 |
Message-ID: | CAHJZqBDzavGCyY9=rFbR6Bt7WMwOT8wGO4HDwR-Ee4MY+V372Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, Mar 2, 2020, 12:30 Vik Fearing <vik(at)postgresfriends(dot)org> wrote:
> On 02/03/2020 18:09, Don Seiler wrote:
> > The REAL reason for this is that I'm wondering if I created a NOT NULL
> > check constraint with "NOT VALID" would that then NOT be considered in
> such
> > a "short-circuit" case until I ran the VALIDATE CONSTRAINT on it?
> Perhaps I
> > should have just asked this in its own thread but I started diving into
> the
> > query plan thing.
>
> You cannot do this because NOT NULL isn't a real constraint (meaning it
> does not appear in pg_constraint). There have been several attempts to
> make it a real constraint over the years but so far nothing has come of
> them
Using the check constraint method seemed to allow for the "not valid" step.
I'm curious what the difference is between a NOT NULL check constraint
versus setting the column to NOT NULL (assuming both are validated).
Don.
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Brannen | 2020-03-02 23:02:20 | RE: trouble making PG use my Perl |
Previous Message | Adrian Klaver | 2020-03-02 21:11:19 | Re: Detecting which columns a query will modify in a function called by a trigger |