UNIQUE KEY with null value...

From: Diego <diego(at)unimedijui(dot)com(dot)br>
To: pgsql-admin(at)postgresql(dot)org
Subject: UNIQUE KEY with null value...
Date: 2005-11-01 18:09:24
Message-ID: 4367AF54.6010909@unimedijui.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Darley 2005-11-01 18:52:20 Can't dump and restore
Previous Message Jim C. Nasby 2005-11-01 17:43:12 Re: UNIQUE KEY with null value...