X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id EE5AAD1D237 for ; Tue, 20 Jan 2004 14:34:09 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 33473-03 for ; Tue, 20 Jan 2004 10:33:42 -0400 (AST) Received: from spoetnik.xs4all.nl (spoetnik.xs4all.nl [213.84.24.58]) by svr1.postgresql.org (Postfix) with ESMTP id DD275D1D8A2 for ; Tue, 20 Jan 2004 10:33:21 -0400 (AST) Received: by spoetnik.xs4all.nl (Postfix, from userid 1000) id C6AF83E21; Tue, 20 Jan 2004 15:33:22 +0100 (CET) Date: Tue, 20 Jan 2004 15:33:22 +0100 From: Reinoud van Leeuwen To: pgsql-sql@postgresql.org Subject: Re: comparing nulls Message-ID: <20040120153322.U66382@spoetnik.xs4all.nl> Mail-Followup-To: pgsql-sql@postgresql.org References: <04012019131206.01434@thenilgiris.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <04012019131206.01434@thenilgiris.com>; from lawgon@thenilgiris.com on Tue, Jan 20, 2004 at 07:13:12PM +0530 X-message-flag: Warning! The sender of this mail thinks you should use a more secure email client. X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/181 X-Sequence-Number: 16574 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 __________________________________________________