Re: FW: "=" operator vs. "IS"

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Stefan Weiss <spaceman(at)foo(dot)at>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: FW: "=" operator vs. "IS"
Date: 2004-06-28 23:24:24
Message-ID: 20040628161747.C38283@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Kenneth Gonsalves 2004-06-29 00:48:41 finding if a foreign key is in use
Previous Message Stefan Weiss 2004-06-28 23:02:24 Re: FW: "=" operator vs. "IS"