On 7/13/06, Chris Hoover <revoohc@xxxxxxxxx> wrote:
On this table, I have created a unique index on payer_trn03, payer_trn04, and expire_timestamp. However, since the expire_timestamp is normally null, the unique index does not appear to be working. I have been able to enter two identical rows into this table. Why is PostgreSQL not enforcing this index? This appears to be a pretty major a bug? It would seem that you could have a unique index across columns that might have a null in them.
From: http://www.postgresql.org/docs/8.1/interactive/indexes-unique.html Quote: "When an index is declared unique, multiple table rows with equal indexed values will not be allowed. Null values are not considered equal. A multicolumn unique index will only reject cases where all of the indexed columns are equal in two rows." Regards, Rodrigo