UNIQUE KEY with null value... - Mailing list pgsql-admin

From Diego
Subject UNIQUE KEY with null value...
Date
Msg-id 4367AF54.6010909@unimedijui.com.br
Whole thread Raw
Responses Re: UNIQUE KEY with null value...  (Eric Faulhaber <ecf@goldencode.com>)
Re: UNIQUE KEY with null value...  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: UNIQUE KEY with null value...  ("Jim C. Nasby" <jnasby@pervasive.com>)
Re: UNIQUE KEY with null value...  (Tzvetan Tzankov <tzankov@noxis.net>)
List pgsql-admin
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



pgsql-admin by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: Pre-allocate space in advance
Next
From: "Tomeh, Husam"
Date:
Subject: Re: Pre-allocate space in advance