From: | "Sterpu Victor" <victor(at)caido(dot)ro> |
---|---|
To: | "PostgreSQL General" <pgsql-general(at)postgresql(dot)org> |
Subject: | Unique index problem |
Date: | 2015-12-20 15:50:47 |
Message-ID: | em17f49055-156c-40e5-ae9d-252d62bed17d@victor-pc |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello
I created a unique index that doesn't seem to work when one column is
NULL.
Index is created like this: CREATE UNIQUE INDEX
lab_tests_groups_siui_uni ON lab_tests_groups_siui(id_lab_tests_siui,
id_lab_tests_groups, valid_from, id_lab_sample_types);
Now I can run this insert twice and I will have 2 records in the
database that seem to violate this index:
INSERT INTO lab_tests_groups_siui(id_lab_tests_siui,
id_lab_tests_groups, valid_from) VALUES(463, 9183, '2014-06-01');
When I create the index like this "CREATE UNIQUE INDEX
lab_tests_groups_siui_uni ON lab_tests_groups_siui(id_lab_tests_siui,
id_lab_tests_groups, valid_from);" index works fine.
I tested this on postgres 9.1.4 and 9.1.9.
Thank you.
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2015-12-20 16:00:38 | Re: Unique index problem |
Previous Message | oleg yusim | 2015-12-20 15:16:44 | Session Identifiers |