is NULL = NULL true or false?

From: "Gene Selkov, Jr(dot)" <selkovjr(at)mcs(dot)anl(dot)gov>
To: pgsql-general(at)postgreSQL(dot)org
Subject: is NULL = NULL true or false?
Date: 1998-11-09 17:58:46
Message-ID: 199811091757.LAA03182@antares.mcs.anl.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi,

I am joining two or more tables on the column that has quite a number
of nulls, assuming 'a.key = b.key' to be a valid expression even when
both operands are NULLs. The result set is way smaller that I
expect. Could that be because the two NULLs do not match?

I guess there are two possible ways to treat the NULL = NULL
problem. One is to say, "Don't know. There is no information to say
whether this is true or false". The second is to say, "Yes, these two
entities are the same. They are equally undetermined".

The function I want to achieve is:

'a.key = b.key' OR ((a.key IS NULL) AND (b.key IS NULL))

Isn't it the way it's wired?

--Gene

Browse pgsql-general by date

  From Date Subject
Next Message Charles Curley 1998-11-09 18:12:16 Re: [GENERAL] Case insensitive "contains" search
Previous Message David Hartwig 1998-11-09 17:42:07 Re: [GENERAL] Incrementing a Serial Field