Re: strange IS NULL behaviour

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andres Freund <andres(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hannu Krosing <hannu(at)2ndquadrant(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: strange IS NULL behaviour
Date: 2013-09-10 19:48:08
Message-ID: 1378842488.63685.YahooMailNeo@web162901.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)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.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2013-09-10 19:52:00 Re: strange IS NULL behaviour
Previous Message Merlin Moncure 2013-09-10 19:43:07 Re: strange IS NULL behaviour