Re: very big problem with NULL

From: "Gregory Wood" <gregw(at)com-stock(dot)com>
To: "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: very big problem with NULL
Date: 2001-06-12 20:31:18
Message-ID: 003501c0f37e$a65ff7f0$7889ffcc@comstock.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> > The thing about NULL is ... you just don't know!

<snip what I thought was a very good example>

> so what you're saying is NULL = * in Postgres?? With every other database
> server I've used, NULL is its own value, not any value, or I'm completely
> misunderstanding what you're trying to say here.

Either you are mistaken, or those other databases were incorrectly
implemented (assuming they were following the SQL standard). Here is an
independant Knowledge Base item (with a great subject: "SQL: NULL is not
Nothing") that discusses NULLs in Oracle:

http://www.metrokc.gov/gis/services/KnowledgeBase/SQLtipNull.htm

They even quote the Oracle documentation:

"To test for nulls, use only the comparison operators IS NULL and IS NOT
NULL. If you use any other operator with nulls and the result depends on the
value of the null, the result is UNKNOWN. Because null represents a lack of
data, a null cannot be equal or unequal to any value or to another null."

> However, the last time i checked, NULL does not equal to 1, 2, 3, or
> anything else besides NULL. Thats why I'm confused as to why SELECT
column
> FROM table WHERE column != 1 also excludes NULL, because 1 does NOT have
the
> same value as NULL.

NULL does NOT *have* a value. NULL is an *undefined* value. Therefore you
can't say if it is equal to a value or not. They probably said it better
than I am: "A condition that evaluates to UNKNOWN acts almost like FALSE.
For example, a SELECT statement with a condition in the WHERE clause that
evaluates to UNKNOWN returns no rows."

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gregory Wood 2001-06-12 20:39:38 Re: WAS: PostgreSQL Replication Server? IS: Zend comparison
Previous Message Limin Liu 2001-06-12 20:31:04 Re: Big5 contains '\'