Re: Not Null Constraint vs Query Planning - Mailing list pgsql-general

From Vik Fearing
Subject Re: Not Null Constraint vs Query Planning
Date
Msg-id 0fdec022-0025-961f-4dfb-c40b95a9be07@postgresfriends.org
Whole thread Raw
In response to Re: Not Null Constraint vs Query Planning  (Don Seiler <don@seiler.us>)
List pgsql-general
On 03/03/2020 00:02, Don Seiler wrote:
> On Mon, Mar 2, 2020, 12:30 Vik Fearing <vik@postgresfriends.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



pgsql-general by date:

Previous
From: Kevin Brannen
Date:
Subject: RE: trouble making PG use my Perl
Next
From: Tom Lane
Date:
Subject: Re: trouble making PG use my Perl