Re: Can't join on null values

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: David Newall <davidn-postgres(at)rebel(dot)net(dot)au>
Cc: PostgreSQL bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Can't join on null values
Date: 2004-07-07 19:41:37
Message-ID: 20040707123849.J58709@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On Tue, 6 Jul 2004, David Newall wrote:

> PostgreSQL version: 7.4.3 (RPMs from ftp.au.postgresql.org)
>
> Operating Sysem: Fedora Core 1
>
> CREATE TABLE t1 (i INTEGER, j INTEGER);
> INSERT INTO t1 VALUES (1, NULL);
> CREATE TABLE t2 AS SELECT * FROM t1;
> SELECT * FROM t1 JOIN t2 USING (i, j);
> i | j
> ---+---
> (0 rows)
>
> I believe the one row, which is identically present in both table,
> should be selected. The problem occurs because of the NULL value.

NULL is not equal to NULL so I don't think the values for j meet
the join condition "for which the corresponding join columns have equal
values."

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Rosser Schwarz 2004-07-07 20:27:19 Re: [PERFORM] finding a max value
Previous Message Stephan Szabo 2004-07-07 19:38:45 Re: UNIQUE not honoured for NULL