FW: "=" operator vs. "IS"

From: "Dmitri Bichko" <dbichko(at)genpathpharma(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: FW: "=" operator vs. "IS"
Date: 2004-06-28 22:17:17
Message-ID: 7A4ADADFC8AFF0478D47F63BEDD57CE33A320C@gpmail.gphq.genpathpharma.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

You are exactly right - the way I think about it is that if you have two
values which are unknown (a null column and NULL) it does not follow
that they are equal to each other.

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.

Dmitri

-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org
[mailto:pgsql-sql-owner(at)postgresql(dot)org] On Behalf Of Stefan Weiss
Sent: Monday, June 28, 2004 6:02 PM
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] "=" operator vs. "IS"

Hi.

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?

If it's the "unknown" part, then why can't I use "=" to compare with
TRUE or FALSE?

cheers,
stefan

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Steve Crawford 2004-06-28 22:27:14 Re: "=" operator vs. "IS"
Previous Message Stefan Weiss 2004-06-28 22:02:29 "=" operator vs. "IS"