Re: Some more weird NULL behavior

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Ludwig Lim <lud_nowhere_man(at)yahoo(dot)com>
Cc: PostgreSQL Mailing List <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Some more weird NULL behavior
Date: 2002-11-09 05:13:43
Message-ID: 20021108210410.F19592-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 8 Nov 2002, Ludwig Lim wrote:

> Hi:
>
> I tried the following:
> CREATE TABLE x(
> a NUMERIC(5,0),
> b VARCHAR(5)
> );
>
> CREATE TABLE y(
> a INTEGER,
> b VARCHAR(5)
> );
>
> INSERT INTO x(b) VALUES ('LUDZ');
> INSERT INTO y(b) VALUES ('TEST');
>
> SELECT x.b,y.b FROM x,y WHERE x.a=y.a
> returns zero rows.

A comparison of two NULL values does not
return true, it returns unknown.
If you want to say equal or both null you
should do it explitly.
(x.a=y.a) or (x.a is null and y.a is null)

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message karthick v 2002-11-09 05:30:06 Output of function into a file
Previous Message Tom Lane 2002-11-09 04:33:31 Re: More than 1 trigger of the same kind