Skip site navigation (1) Skip section navigation (2)

Re: weird results from trivial SELECT statement

From: Lew <noone(at)lewscanon(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: weird results from trivial SELECT statement
Date: 2011-04-28 13:35:07
Message-ID: ipbqdl$jem$2@news.albasani.net (view raw or flat)
Thread:
Lists: pgsql-novice
Brent Dombrowski wrote:
> Lonni J Friedman wrote:
>
>> Greetings,
>> I've got a Postgresql-8.4.x instance with a bunch of tables taht have
>> a text column (called 'active') that can contain any one of the
>> following values:
>> NULL
>> 'disabled'
>> <some other text string>
>>
>> When I run the following query, it seems to ignore NULL values:
>> SELECT * FROM mytbl WHERE active!='disabled'
>>
>> and only returns rows where active!='disabled' AND active IS NOT NULL.
>> Is postgresql implicitly assuming that I want non-NULL values?
>>
>> I can provide additional information, if requested.

> Unfortunately, there is only one NULL and it can take on several meanings.
> Because of this, most databases will not perform comparison operations on NULL.
> NULL is not comparable to anything, including itself.
> NULL == NULL will return FALSE on most systems.

"Most" databases?  "Most" systems?

*ALL* SQL-compliant products.

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

In response to

pgsql-novice by date

Next:From: LewDate: 2011-04-28 13:40:42
Subject: Re: failure and silence of SQL commands
Previous:From: LewDate: 2011-04-28 13:31:28
Subject: Re: weird results from trivial SELECT statement

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group