Is NULL equal to NULL or not?

Поиск
Список
Период
Сортировка
От jco@cornelius-olsen.dk
Тема Is NULL equal to NULL or not?
Дата
Msg-id OF166ABDEB.AEB8B9D5-ONC1256C8A.007432E1@dk
обсуждение исходный текст
Ответы Re: Is NULL equal to NULL or not?  ("scott.marlowe" <scott.marlowe@ihs.com>)
Список pgsql-general

Hi,

My first message on this list:

Using PostgreSQL 7.1.3.

I've noticed that
        select NULL=NULL;
yields TRUE. It is also possible to select rows in this manner.

At the same time in PL/pgSQL:

        > drop function demo1();
        create function demo1() returns boolean as '
        declare
          a boolean:=NULL;
          b boolean:=NULL;
        begin
          return a=b;
        end;
        ' language 'plpgsql';

        > select demo1();
yields NULL. Yet if I'd written "return NULL=NULL" I would have gotten the same result as in the simple query;

Is there any logical explanation for this inconsistency? ... or should I have been posting a bug? :-)

Regards
/Jørn Cornelius Olsen

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

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: table functions
Следующее
От: "Robert Fitzpatrick"
Дата:
Сообщение: Field sizes and structure