From: Vik Fearing <vik@postgresfriends.org>
To: Don Seiler <don@seiler.us>
Cc: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Not Null Constraint vs Query Planning
Date: Tue, 3 Mar 2020 00:13:24 +0100
Message-ID: <0fdec022-0025-961f-4dfb-c40b95a9be07@postgresfriends.org> (raw)
In-Reply-To: <CAHJZqBDzavGCyY9=rFbR6Bt7WMwOT8wGO4HDwR-Ee4MY+V372Q@mail.gmail.com>
References: <CAHJZqBCHaNgmX8PmfLD5XzdsJphT6fHB65QnhUCTkfBrnr2OEw@mail.gmail.com>
<85a9f663-a198-9fe2-96d3-6e2d5d74b22c@postgresfriends.org>
<CAHJZqBDzavGCyY9=rFbR6Bt7WMwOT8wGO4HDwR-Ee4MY+V372Q@mail.gmail.com>
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
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: vik@postgresfriends.org, don@seiler.us
Subject: Re: Not Null Constraint vs Query Planning
In-Reply-To: <0fdec022-0025-961f-4dfb-c40b95a9be07@postgresfriends.org>
References: <CAHJZqBCHaNgmX8PmfLD5XzdsJphT6fHB65QnhUCTkfBrnr2OEw@mail.gmail.com> <85a9f663-a198-9fe2-96d3-6e2d5d74b22c@postgresfriends.org> <CAHJZqBDzavGCyY9=rFbR6Bt7WMwOT8wGO4HDwR-Ee4MY+V372Q@mail.gmail.com> <0fdec022-0025-961f-4dfb-c40b95a9be07@postgresfriends.org>
* 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