Re: "IS NOT NULL" != "NOT NULL"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sean Chittenden <sean(at)chittenden(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: "IS NOT NULL" != "NOT NULL"
Date: 2002-01-19 21:46:38
Message-ID: 23060.1011476798@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sean Chittenden <sean(at)chittenden(dot)org> writes:
> test_pgsql=# SELECT COUNT(*) FROM test WHERE col2 NOTNULL;
> count
> -------
> 3
> (1 row)

> test_pgsql=# SELECT COUNT(*) FROM test WHERE col2 != NULL;
> count
> -------
> 0
> (1 row)

These are not the same thing. See any of the past discussions about
why "null = null" and "null != null" and so forth do not do what a
novice might expect.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Barnard 2002-01-19 22:10:09 Clarification question
Previous Message Sean Chittenden 2002-01-19 21:19:13 Re: "IS NOT NULL" != "NOT NULL"