behavior of ' = NULL' vs. MySQL vs. Standards

Поиск
Список
Период
Сортировка
От Mark Stosberg
Тема behavior of ' = NULL' vs. MySQL vs. Standards
Дата
Msg-id 3B1ED23A.984C3159@summersault.com
обсуждение исходный текст
Ответы Re: behavior of ' = NULL' vs. MySQL vs. Standards  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-sql
Hello,

I'm a long time Postgres user who uses MySQL when I have to. I recently
ran into an issue with MySQL where this construct didn't do what I expect:

WHERE date_column = NULL

I expected it to work like "date_column IS NULL" like it does it
Postgres 7.0.2, but instead it returned an empty result set. 

After conversing with some folks on the MySQL list, it was mentioned that:
* "NULL is *NOT* a value. It's an absence of a value, and doing *any*
comparisons with NULL is invalid (the result must always be NULL, even
if you say "foo = NULL")." 
* Postgres handling is non-standard (even if it's intuitive.) 

My questions then are: 1.) What IS the standard for handling NULLs? and
then 2.) If Postgres handling is different than the standard, what's the
reason? 

To me, having " = NULL" be the same as " IS NULL" is intuitive and thus
useful, but I also like appeal of using standards when possible. :) 

Thanks!
 -mark

http://mark.stosberg.com/


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: maximum number of rows in table - what about oid limits?
Следующее
От: John Scott
Дата:
Сообщение: Re: maximum number of rows in table - what about oid limits?