Created
January 17, 2014 14:03
-
-
Save omarqureshi/8473793 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
omarqureshi=# create unique index foos_some_field_idx on foos(some_field); | |
CREATE INDEX | |
omarqureshi=# insert into foos(some_field) values (null); | |
INSERT 0 1 | |
omarqureshi=# insert into foos(some_field) values (null); | |
INSERT 0 1 | |
omarqureshi=# insert into foos(some_field) values ('a'); | |
INSERT 0 1 | |
omarqureshi=# insert into foos(some_field) values ('a'); | |
ERROR: duplicate key value violates unique constraint "foos_some_field_idx" | |
DETAIL: Key (some_field)=(a) already exists. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment