Re: [HACKERS] Re: Comparisons on NULLs (was Re: A small problem...)
От | darcy@druid.net (D'Arcy J.M. Cain) |
---|---|
Тема | Re: [HACKERS] Re: Comparisons on NULLs (was Re: A small problem...) |
Дата | |
Msg-id | m0zb2Xk-0000eRC@druid.net обсуждение исходный текст |
Ответ на | Re: [HACKERS] Re: Comparisons on NULLs (was Re: A small problem...) (dg@informix.com (David Gould)) |
Список | pgsql-hackers |
Thus spake David Gould > D'Arcy J.M. Cain <darcy@{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@{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.
В списке pgsql-hackers по дате отправления: