bug in "create unique index"

Поиск
Список
Период
Сортировка
Искать

bug in "create unique index"

От:
Domingo Alvarez Duarte <domingo@dad-it.com>
Дата:
when creating a index unique in a table that accept nulls the unique
constraint doesn't work. 

Example:
---
create table test_unique(i1 integer, i2 integer, unique(i1,i2);
insert into test_unique(1,null);
insert into test_unique(1,null);
insert into test_unique(1,null);
---
all "inserts" above insert sucefully.

Re: bug in "create unique index"

От:
Stephan Szabo <sszabo@megazone23.bigpanda.com>
Дата:

This is correct by spec.  NULLs are a special case.

From UNIQUE ", then the result of the  is true; otherwise, the result of the   is false.

[This means that there will be no two rows such that the value
of each column in non-null and is equal to to the value in the
other since one of the columns is null]

On Sun, 13 May 2001, Domingo Alvarez Duarte wrote:

> when creating a index unique in a table that accept nulls the unique
> constraint doesn't work. 
> 
> Example:
> ---
> create table test_unique(i1 integer, i2 integer, unique(i1,i2);
> insert into test_unique(1,null);
> insert into test_unique(1,null);
> insert into test_unique(1,null);
> ---
> all "inserts" above insert sucefully.
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 


FAQ