Re: BUG #6701: IS NOT NULL doesn't work on complex composites - Mailing list pgsql-bugs

From Kevin Grittner
Subject Re: BUG #6701: IS NOT NULL doesn't work on complex composites
Date
Msg-id 4FE2E9710200002500048881@gw.wicourts.gov
Whole thread Raw
In response to Re: BUG #6701: IS NOT NULL doesn't work on complex composites  (Rikard Pavelic <rikard.pavelic@zg.htnet.hr>)
Responses Re: BUG #6701: IS NOT NULL doesn't work on complex composites
List pgsql-bugs
Rikard Pavelic <rikard.pavelic@zg.htnet.hr> wrote:

> The only inconsistent thing is check constraint, which behaves as
> NOT column IS NULL instead of column IS NOT NULL as docs says.

So currently a NOT NULL constraint on a column with a composite type
is equivalent to:

CHECK (NOT c IS NULL)

and the question is whether that is correct, or whether it should be
equivalent to:

CHECK (c IS NOT NULL)

> I even prefer that behavior.

I think I prefer current behavior, too; but I'm inclined to be
guided by the SQL spec if it is unambiguous about which is correct.
(I haven't checked yet -- does anyone already know without having to
dig through the spec?)  Either way, it probably deserves some brief
mention in the docs.  FWIW, a strict reading of the current
PostgreSQL docs ("The column is not allowed to contain null
values.") matches the current behavior, since the other way would
need to be stated as something like "The column can only contain
non-null values."

-Kevin

pgsql-bugs by date:

Previous
From: Viswanatham Kiran Kumar
Date:
Subject: Re: log_truncate_on_rotation=on is not truncating
Next
From: Tom Lane
Date:
Subject: Re: BUG #6701: IS NOT NULL doesn't work on complex composites