Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3380F474E61 for ; Sat, 9 Nov 2002 00:13:39 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 9BFAE474E44 for ; Sat, 9 Nov 2002 00:13:38 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id CD0AFD61C; Fri, 8 Nov 2002 21:13:43 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id C2C4F5C03; Fri, 8 Nov 2002 21:13:43 -0800 (PST) Date: Fri, 8 Nov 2002 21:13:43 -0800 (PST) From: Stephan Szabo To: Ludwig Lim Cc: PostgreSQL Mailing List Subject: Re: Some more weird NULL behavior In-Reply-To: <20021109043013.3645.qmail@web80307.mail.yahoo.com> Message-ID: <20021108210410.F19592-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/153 X-Sequence-Number: 10295 On Fri, 8 Nov 2002, Ludwig Lim wrote: > Hi: > > I tried the following: > CREATE TABLE x( > a NUMERIC(5,0), > b VARCHAR(5) > ); > > CREATE TABLE y( > a INTEGER, > b VARCHAR(5) > ); > > INSERT INTO x(b) VALUES ('LUDZ'); > INSERT INTO y(b) VALUES ('TEST'); > > SELECT x.b,y.b FROM x,y WHERE x.a=y.a > returns zero rows. A comparison of two NULL values does not return true, it returns unknown. If you want to say equal or both null you should do it explitly. (x.a=y.a) or (x.a is null and y.a is null)