UNIQUE KEY with null value...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux