X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 00EE4D1B78B for ; Thu, 1 Jul 2004 17:37:27 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 63324-06 for ; Thu, 1 Jul 2004 20:37:26 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id C0082D1B798 for ; Thu, 1 Jul 2004 17:37:24 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i61KbKZ9068658 for ; Thu, 1 Jul 2004 20:37:24 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i61KBM0a052079 for pgsql-sql@postgresql.org; Thu, 1 Jul 2004 20:11:22 GMT X-Abuse-Report: abuse@teranews.com Message-ID: <41955aeb655d4b2976f0ae6878b95fa6@news.teranews.com> Date: Thu, 01 Jul 2004 15:02:25 GMT Lines: 33 From: Jeff Boes User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040616 X-Accept-Language: en-us, en MIME-Version: 1.0 X-Newsgroups: comp.databases.postgresql.sql Subject: Re: FW: "=" operator vs. "IS" References: <7A4ADADFC8AFF0478D47F63BEDD57CE33A320C@gpmail.gphq.genpathpharma.com> In-Reply-To: <7A4ADADFC8AFF0478D47F63BEDD57CE33A320C@gpmail.gphq.genpathpharma.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=DATE_IN_PAST_03_06 X-Spam-Level: X-Archive-Number: 200407/8 X-Sequence-Number: 18260 > I'm just curious - why is it not possible to use the "=" operator to > compare values with NULL? I suspect that the SQL standard specified it > that way, but I can't see any ambiguity in an expression like "AND > foo.bar = NULL". Is it because NULL does not "equal" any value, and the > expression should be read as "foo.bar is unknown"? Or is there something > else I'm missing? As noted elsewhere, joining two tables on "a.foo = b.foo" where both foo values are NULL is not usually what you want. But if you really, truly do want that, then you always have this: coalesce(a.foo,0) = coalesce(b.foo,0) or a similar construct, using something in place of zero that has the same base type as a.foo and b.foo, and which doesn't occur in either table. (Why? Because you really don't want a.foo = coalesce(b.foo,0) or b.foo = coalesce(a.foo,0) to give you false positives.) -- (Posted from an account used as a SPAM dump. If you really want to get in touch with me, dump the 'jboes' and substitute 'mur'.) ________ Jeffery Boes <>< jboes@qtm.net