Re: null != null ???

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: null != null ???
Дата
Msg-id 3BD986BE.81A735A4@fourpalms.org
обсуждение исходный текст
Ответ на null != null ???  (Fran Fabrizio <ffabrizio@mmrd.com>)
Ответы Re: null != null ???  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
...
> This is an odd result.  Both sides of that where clause evaluate to
> null, so it is null=null, yet this is not evaluating to true
> because I'm getting no rows back.

This is expected behavior. NULL means "unknown", so you can not know
that they are equivalent. But it is *not* the same as "NULL=NULL",
because...

>  Just to confirm that null=null
> evaluates to true (double-checking my sanity):
> monitoring=# select null=null;
> ----------
>  t
> (1 row)
> Ok, quite bizarre.

Yes, this is an explicit feature in our parser to help out poor MSAccess
souls who have a product which generates illegal SQL queries. We put in
a specific rule to convert "anything=NULL" to "anything IS NULL", which
*is* legal syntax.

Check the archives to discover that no one is very happy with this
feature, except folks trying to use ODBC via Access and some goofy forms
interface. Sorry that it has bit you, but basically you should not rely
on this hack at any time, and the behavior "expr=expr" returning false
when each expression evaluates to NULL conforms to SQL standards.

> Can someone smarter than me tell me what I am missing?

I may not be smarter, just "been there, done that"; hopefully you will
find the information useful anyway ;)

                  - Thomas

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

Предыдущее
От: Fran Fabrizio
Дата:
Сообщение: null != null ???
Следующее
От: Vivek Khera
Дата:
Сообщение: Re: DBD::Pg