Re: Null...

From: Keary Suska <hierophant(at)pcisys(dot)net>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Null...
Date: 2001-10-05 19:14:56
Message-ID: B7E362D0.42E3%hierophant@pcisys.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

According to the SQL rules, a NULL value can not be reliably compared to
anything except a NULL value. Technically, I believe, that the result of
comparing NULL to anything except NULL should result in the value of NULL,
and not "true" or "false". There may be something about x=NULL always being
false, and NULL=NULL always being true, but I don't recall completely.

That is the reason for the traditional approach of avoiding NULL values
except where you explicitly need/want them, as it creates unpredictable
results.

The proper way of addressing NULL values is using the IS NULL and IS NOT
NULL comparisons.

Keary Suska
Esoteritech, Inc.
"Leveraging Open Source for a better Internet"

> From: "Mihai Gheorghiu" <tanethq(at)earthlink(dot)net>
> Date: Fri, 5 Oct 2001 14:30:47 -0400
> To: <pgsql-general(at)postgresql(dot)org>
> Subject: [GENERAL] Null...
>
> PG7.1.2 on RH7.0
>
> select 'a'<>null;
> ?column?
> ----------
>
> (1 row)
>
> select 'a'!=null;
> ?column?
> ----------
>
> (1 row)
>
> select 'a'=null;
> ?column?
> ----------
> f
> (1 row)
>
> select 'a'||null;
> ?column?
> ----------
>
> (1 row)
>
> Can someone please explain the above?
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

In response to

  • Null... at 2001-10-05 18:30:47 from Mihai Gheorghiu

Browse pgsql-general by date

  From Date Subject
Next Message Keary Suska 2001-10-05 19:51:50 Re: resequencing an existing sequence
Previous Message Test Wing 2001-10-05 19:14:40 psql: ERROR: MultiByte strings (MB) must be enabled to use this f unction