Re: BUG #6701: IS NOT NULL doesn't work on complex composites

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: rikard(dot)pavelic(at)zg(dot)htnet(dot)hr
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6701: IS NOT NULL doesn't work on complex composites
Date: 2012-06-20 19:10:54
Message-ID: 2782.1340219454@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

rikard(dot)pavelic(at)zg(dot)htnet(dot)hr writes:
> create type t AS (i int);
> create type complex as (t t, i int);
> create table bad(i int, c complex);

> insert into bad values(1, null);
> insert into bad values(1, ROW(null, 2));
> insert into bad values(1, ROW(ROW(1), 2));

> select * from bad;
> select * from bad where c is null;

> --This doesn't work as expected
> select * from bad where c is not null;

What do you consider to be "expected"? Have you read the documentation
where it points out that IS NULL and IS NOT NULL are not inverses for
composite values?
http://www.postgresql.org/docs/9.1/static/functions-comparison.html

(I'm not that thrilled with this behavior either, but it is per SQL
standard AFAICT.)

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Rikard Pavelic 2012-06-20 19:17:00 Re: BUG #6701: IS NOT NULL doesn't work on complex composites
Previous Message Kevin Grittner 2012-06-20 19:08:15 Re: BUG #6701: IS NOT NULL doesn't work on complex composites