From: Reinoud van Leeuwen <reinoud.v@n.leeuwen.net>
To: pgsql-sql@postgresql.org
Subject: Re: comparing nulls
Date: Tue, 20 Jan 2004 15:33:22 +0100
Message-ID: <20040120153322.U66382@spoetnik.xs4all.nl> (raw)
In-Reply-To: <04012019131206.01434@thenilgiris.com>
References: <04012019131206.01434@thenilgiris.com>
On Tue, Jan 20, 2004 at 07:13:12PM +0530, Kenneth Gonsalves wrote:
> in postgres7.1 i had a table where an integer field could be null. There was
> no default value. a select statement like so:
> 'select * from table where field = null'
> would give all the rows where that field had no value.
> on porting to 7.3.2, this doesnt work. How to do this?
Because NULL can be read as "unknown". It does not make much sense to
test wheter a value of an integer is numerically equal to unknown. That is
why there is the IS operator:
where field IS null
--
__________________________________________________
"Nothing is as subjective as reality"
Reinoud van Leeuwen reinoud.v@n.leeuwen.net
http://www.xs4all.nl/~reinoud
__________________________________________________
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: reinoud.v@n.leeuwen.net
Subject: Re: comparing nulls
In-Reply-To: <20040120153322.U66382@spoetnik.xs4all.nl>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox