Re: Not Null Constraint vs Query Planning

From: Vik Fearing <vik(at)postgresfriends(dot)org>
To: Don Seiler <don(at)seiler(dot)us>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Not Null Constraint vs Query Planning
Date: 2020-03-02 23:13:24
Message-ID: 0fdec022-0025-961f-4dfb-c40b95a9be07@postgresfriends.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/03/2020 00:02, Don Seiler wrote:
> 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).

You kind of answered your own question there.
--
Vik Fearing

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2020-03-02 23:23:08 Re: trouble making PG use my Perl
Previous Message Kevin Brannen 2020-03-02 23:02:20 RE: trouble making PG use my Perl