Re: UNIQUE KEY with null value...

Поиск
Список
Период
Сортировка
От Jim C. Nasby
Тема Re: UNIQUE KEY with null value...
Дата
Msg-id 20051101174312.GT20349@pervasive.com
обсуждение исходный текст
Ответ на UNIQUE KEY with null value...  (Diego <diego@unimedijui.com.br>)
Список pgsql-admin
http://www.postgresql.org/docs/8.0/interactive/sql-createtable.html

 For the purpose of a unique constraint, null values are not considered
 equal.

On Tue, Nov 01, 2005 at 03:09:24PM -0300, Diego wrote:
> Hi,
> I?m a brazilian programmer!
>
> I have a question about Postgres UNIQUE KEY. Look:
>
> (Step 1)
> CREATE TABLE test (
> id integer not null primary key,
> id_uni integer not null,
> cod integer,
> name varchar(40),
> constraint test_uk unique(id_uni, cod)
> )
>
> (Step 2)
> insert into test (id, id_uni, cod, name)
> values (1, 1, null, 'A')
>
> (Step 3)
> insert into test (id, id_uni, cod, name)
> values (2, 1, null, 'B') =========> [Have the same UNIQUE KEY]
>
> Why postgresql don?t break insertion in this case????
>
> Thanks
> Diego Ziquinatti
> Brazil
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>               http://archives.postgresql.org
>

--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

В списке pgsql-admin по дате отправления:

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: Pre-allocate space in advance
Следующее
От: "Peter Darley"
Дата:
Сообщение: Can't dump and restore