Re: Can't join on null values

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: David Newall <davidn-postgres(at)rebel(dot)net(dot)au>, PostgreSQL bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Can't join on null values
Date: 2004-07-07 19:25:21
Message-ID: 200407072125.21247.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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.

A join happens when two values are equal in the sense of the operator =.
But "NULL = NULL" is not true, so the behavior is correct.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2004-07-07 19:25:52 Re: UNIQUE not honoured for NULL
Previous Message PostgreSQL Bugs List 2004-07-07 17:15:23 BUG #1189: unbounded string copy in postmaster