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: UNIQUE not honoured for NULL |
Date: | 2004-07-07 19:38:45 |
Message-ID: | 20040707123545.I58709@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 t(i integer UNIQUE);
> INSERT INTO t VALUES (null);
> INSERT INTO t VALUES (null);
> SELECT coalesce(i,-999) FROM t;
> coalesce
> ----------
> -999
> -999
> (2 rows)
NULL values are explicitly allowed to be duplicated in unique constraints
by spec AFAICS. The unique constraint is defined in terms of the unique
predicate which says: "If there are no two rows in T such that the value
of each column in one row is non-null and is equal to the value of the
corresponding column in the other row according to Subclause 8.2,
"<comparison predicate>", then the result of the <unique predicate> is
true; otherwise, the result of the <unique predicate> is false."
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2004-07-07 19:41:37 | Re: Can't join on null values |
Previous Message | Pavel Stehule | 2004-07-07 19:38:39 | Re: Can't join on null values |