Re: UNIQUE not honoured for NULL

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: UNIQUE not honoured for NULL
Date: 2004-07-12 12:47:34
Message-ID: ccu197$44b$1@floppy.pyrenet.fr
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 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)

As someone says NULL = NULL is false
so that two rows are different. If you want enforce
only one null value for that column you have to write
you own trigger.

Regards
Gaetano Mendola

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2004-07-12 14:13:27 Re: BUG #1190: Postgres/Jboss Synchronization
Previous Message PostgreSQL Bugs List 2004-07-12 11:42:37 BUG #1190: Postgres/Jboss Synchronization