Re: cataloguing NOT NULL constraints

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Alvaro Herrera" <alvherre(at)2ndquadrant(dot)com>
Cc: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: cataloguing NOT NULL constraints
Date: 2012-08-16 16:08:15
Message-ID: 502CD49F02000025000497A7@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:

> I think that a NOT NULL constraint attached to a column with a
> composite type is equivalent to a CHECK (col IS DISTINCT FROM
> NULL); at least they seem to behave identically. Is that what you
> would expect?

I had not thought about that, but now that you point it out I think
that interpretation makes more sense than any other. In a quick
test they behaved identically for me.

> This seems a bit complicated to handle with the way I'm doing
> things today; at parse analysis time, when my current code is
> creating the check constraint, we don't know anything about the
> type of the column IIRC. Maybe I will have to delay creating the
> constraint until execution.

Why? CHECK (col IS DISTINCT FROM NULL) works correctly for *any*
type, doesn't it?

-Kevin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2012-08-16 16:17:22 Re: The pgrminclude problem
Previous Message Alvaro Herrera 2012-08-16 16:02:44 Re: HeapTupleHeaderAdvanceLatestRemovedXid doing the wrong thing with multixacts