Re: [BUGS] (null) != (null) ?

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Todd Vierling <tv(at)pobox(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgreSQL(dot)org
Subject: Re: [BUGS] (null) != (null) ?
Date: 1999-10-26 16:48:05
Message-ID: 199910261648.MAA26644@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On Tue, 26 Oct 1999, Tom Lane wrote:
>
> : > Both "fieldname" definitions are identical (verified with char(2) and
> : > varchar(100) in particular), and both tables contain a row with a "null" in
> : > that field. However, the results don't contain the row with the "null"
> : > value.
> :
> : NULL = NULL does not yield TRUE, it yields NULL. For that matter,
> : NULL != NULL does not yield FALSE --- it yields NULL. This is a
> : basic consequence of the semantics of NULL.
>
> !?
>
> I have been using such constructs on commercial databases for ages. Do you
> have a link to a web-based SQL standard transcription that I could look this
> up? (I'll check up on exactly which database(s) I can use this type of
> construct when I get back to work tomorrow....)
>
> It seems _extremely_ counter-intuitive, especially in cases where both
> fields are in fact the same type.

But NULL is unknown. How do you know they are equal if both values are
unknown?

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 1999-10-26 17:44:02 Re: [BUGS] (null) != (null) ?
Previous Message Tom Lane 1999-10-26 16:23:53 Re: [BUGS] (null) != (null) ?