Re: strange IS NULL behaviour - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: strange IS NULL behaviour
Date
Msg-id 20130910195200.GB16378@momjian.us
Whole thread Raw
In response to Re: strange IS NULL behaviour  (Kevin Grittner <kgrittn@ymail.com>)
Responses Re: strange IS NULL behaviour
List pgsql-hackers
On Tue, Sep 10, 2013 at 12:48:08PM -0700, Kevin Grittner wrote:
> Bruce Momjian <bruce@momjian.us> wrote:
> 
> > FYI, I think these queries below prove that NOT NULL constraints do not
> > follow the single-depth ROW NULL inspection rule that PL/pgSQL follows,
> > and that my patch was trying to promote for queries:
> >
> >     CREATE TABLE test2(x test NOT NULL);
> >     CREATE TABLE
> >     INSERT INTO test2 VALUES (null);
> >     ERROR:  null value in column "x" violates not-null constraint
> >     DETAIL:  Failing row contains (null).
> > -->    INSERT INTO test2 VALUES (row(null));
> >     INSERT 0 1
> 
> If I remember correctly, the standard wants a NOT NULL constraint
> on a column with a composite type to behave the same as
> 
>   CHECK (col IS DISTINCT FROM NULL)
> 
> ... which is consistent with the behavior you show.

Is IS DISTINCT FROM correct though?
SELECT ROW(NULL) IS DISTINCT FROM NULL; ?column?---------- t(1 row)

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +



pgsql-hackers by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: strange IS NULL behaviour
Next
From: Kevin Grittner
Date:
Subject: Re: strange IS NULL behaviour