Is NULL equal to NULL or not?

From: jco(at)cornelius-olsen(dot)dk
To: pgsql-general(at)postgresql(dot)org
Subject: Is NULL equal to NULL or not?
Date: 2002-12-09 21:23:33
Message-ID: OF166ABDEB.AEB8B9D5-ONC1256C8A.007432E1@dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Fitzpatrick 2002-12-09 21:44:02 Field sizes and structure
Previous Message Joe Conway 2002-12-09 20:57:45 Re: table functions