Re: [HACKERS] Re: Comparisons on NULLs (was Re: A small problem...)

From: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
To: dg(at)informix(dot)com (David Gould)
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Re: Comparisons on NULLs (was Re: A small problem...)
Date: 1998-11-04 13:00:12
Message-ID: m0zb2Xk-0000eRC@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thus spake David Gould
> D'Arcy J.M. Cain <darcy(at){druid|vex}.net> writes:
> > Hmmm. That would be a problem. Of course, we could treat the null
> > value at the higher level too. I guess that's why we have the "IS
> > NULL" syntax in the first place. It is different than comparing the
> > actual values.
>
> SELECT * FROM t WHERE b = NULL;
>
> _should not_ return any rows. NULL is not "=" to anything, not even another
> NULL. NULL is also not ">", or "<", or "!=" to anything either.
>
> So, "NULL = NULL" is false as is "NULL != NULL".
>
> This indeed is why we have "IS NULL" and "IS NOT NULL".

But no one really has a use for a statement that can never return a row.
If we need that we always have "-- select 1;" (1/2 :-)) so why not let
"= NULL" be a synonym for "IS NULL" and "NOT = NULL" be a synonym for "IS
NOT NULL?"

Well, other than the fact that M$ does it? (Other 1/2 of that :-))

--
D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 424 2871 (DoD#0082) (eNTP) | what's for dinner.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Oliver Elphick 1998-11-04 13:09:03 latest snapshot crashes backend
Previous Message Michael Meskes 1998-11-04 11:27:34 Re: [HACKERS] update and select