Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id A00311975914 for ; Wed, 20 Jun 2012 16:11:08 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1ShQJ1-00021v-8R for pgsql-bugs@postgresql.org; Wed, 20 Jun 2012 19:11:08 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q5KJAsje002783; Wed, 20 Jun 2012 15:10:54 -0400 (EDT) From: Tom Lane To: rikard.pavelic@zg.htnet.hr cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6701: IS NOT NULL doesn't work on complex composites In-reply-to: References: Comments: In-reply-to rikard.pavelic@zg.htnet.hr message dated "Wed, 20 Jun 2012 15:53:37 -0000" Date: Wed, 20 Jun 2012 15:10:54 -0400 Message-ID: <2782.1340219454@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/177 X-Sequence-Number: 33404 rikard.pavelic@zg.htnet.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