Re: Is NULL equal to NULL or not?

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Is NULL equal to NULL or not?
Date: 2002-12-09 23:19:39
Message-ID: Pine.LNX.4.44.0212091516430.31345-100000@appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 9 Dec 2002, scott.marlowe wrote:

> > I've noticed that
> > select NULL=NULL;
> > yields TRUE. It is also possible to select rows in this manner.
>
> That's NOT because null EQUALS null, but because it allowed you to assign
> one null value to another. which technically can be done, so it came out
> true.

This is a common misuderstanding. NULL means indeterminant, not zero or
missing. Since NULL is and unknown value there's no way to compare it with
another unknown value. You are absolutely correct in that the syntax 'are
both values unknown' equates to NULL is NULL while there is no meaning to
NULL=NULL.

Rich

Dr. Richard B. Shepard, President

Applied Ecosystem Services, Inc. (TM)
2404 SW 22nd Street | Troutdale, OR 97060-1247 | U.S.A.
+ 1 503-667-4517 (voice) | + 1 503-667-8863 (fax) | rshepard(at)appl-ecosys(dot)com
http://www.appl-ecosys.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert Fitzpatrick 2002-12-09 23:30:56 Re: Field sizes and structure
Previous Message Bruce Momjian 2002-12-09 23:08:10 Re: MD5 question?