Обсуждение: null = null

Поиск
Список
Период
Сортировка

null = null

От
chester c young
Дата:
the following took me by suprise:

egg=# select null=null;?column?
----------t

if this were true, for example, then only one null key could be in a
unique index, which is certainly not true.

i thought the philosphical idea behind null in SQL was you didn't know,
which can't have equivalence (as versus the pragmatic idea in C where
null is a dead end pointer, which can have equivalence).  or have I
been too involved with my Oracle databases?


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/


Re: null = null

От
Tom Lane
Дата:
chester c young <chestercyoung@yahoo.com> writes:
> the following took me by suprise:
> egg=# select null=null;
>  ?column?
> ----------
>  t

This is a Microsoft-compatibility kluge that is going away in the next
release, or at least not being enabled by default.

regression=# select version();                           version
---------------------------------------------------------------PostgreSQL 7.2b5 on hppa-hp-hpux10.20, compiled by GCC
2.95.3
(1 row)

regression=# select null = null;?column?
----------

(1 row)

regression=# select null IS null;?column?
----------t
(1 row)

regression=# set transform_null_equals to 1;
SET VARIABLE
regression=# select null = null;?column?
----------t
(1 row)


See the 7.2 docs at
http://developer.postgresql.org/docs/postgres/functions-comparison.html
        regards, tom lane