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 D0D82D1B1B0 for ; Mon, 28 Jun 2004 20:26:02 -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 86713-09 for ; Mon, 28 Jun 2004 23:26:01 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 94C44D1B191 for ; Mon, 28 Jun 2004 20:25:55 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 7D80D35197; Mon, 28 Jun 2004 16:24:24 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 7544E350D5; Mon, 28 Jun 2004 16:24:24 -0700 (PDT) Date: Mon, 28 Jun 2004 16:24:24 -0700 (PDT) From: Stephan Szabo To: Stefan Weiss Cc: pgsql-sql@postgresql.org Subject: Re: FW: "=" operator vs. "IS" In-Reply-To: <200406290102.24885.spaceman@foo.at> Message-ID: <20040628161747.C38283@megazone.bigpanda.com> References: <7A4ADADFC8AFF0478D47F63BEDD57CE33A320C@gpmail.gphq.genpathpharma.com> <200406290102.24885.spaceman@foo.at> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/284 X-Sequence-Number: 18229 On Tue, 29 Jun 2004, Stefan Weiss wrote: > On Tuesday, 29 June 2004 00:17, Dmitri Bichko wrote: > > As far as TRUE and FALSE go, from what I know you can use = to compare > > them with boolean columns, unless I misunderstood your question. > > Sorry, I must have remembered that incorrectly, or maybe I've been > thinking of a different DBMS or version. "table.col = TRUE" seems to > work fine for me now. > > I understand that the result of "(anything) = NULL" will always NULL, > so it's a waste of breath. That's where the "IS" operator(?) comes in, > which allows for comparison with NULL. The only question left is why > "IS" can also be used to compare with the TRUE/FALSE keywords (when a > simple "=" should be sufficient here), but not to compare two boolean > columns. IS TRUE and IS FALSE have a different effect from =true and =false when the left hand side is NULL. The former will return false, the latter will return NULL.