Re: 8.1 Unique Index Issue/Bug???

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Rodrigo De Leon <rdeleonp(at)gmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: 8.1 Unique Index Issue/Bug???
Date: 2006-07-13 18:44:42
Message-ID: 44B6949A.7070209@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


>> 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."

To further this... in PostgreSQL:

IS NULL != ''

'' is a blank string and thus an actual value where IS NULL is nothing,
vapor, a blackhole.

That is why IS NULL can be placed in a unique index because it isn't
actually there (in the theorectical sense).

Sincerely,

Joshua D. Drake

>
> Regards,
>
> Rodrigo
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Chris Browne 2006-07-13 19:15:18 Re: 8.1 Unique Index Issue/Bug???
Previous Message Rodrigo De Leon 2006-07-13 16:32:10 Re: 8.1 Unique Index Issue/Bug???