Is NULL equal to NULL or not? - Mailing list pgsql-general

From jco@cornelius-olsen.dk
Subject Is NULL equal to NULL or not?
Date
Msg-id OF166ABDEB.AEB8B9D5-ONC1256C8A.007432E1@dk
Whole thread Raw
Responses Re: Is NULL equal to NULL or not?
List 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 by date:

Previous
From: Joe Conway
Date:
Subject: Re: table functions
Next
From: "Robert Fitzpatrick"
Date:
Subject: Field sizes and structure