Last active
September 8, 2016 12:48
-
-
Save ostronom/0138a6b9ecc440d93c0c9ebc00396ad8 to your computer and use it in GitHub Desktop.
This file contains 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
-- CREATE TABLE t (id bigint primary key, c bigint not null) | |
BEGIN; | |
UPDATE t SET c=1 WHERE id=1; | |
INSERT INTO t (id, c) SELECT 1, 1 WHERE NOT EXISTS (SELECT 1 FROM t WHERE id=1); | |
END; | |
-- pg 9.4.8 | |
-- contraint violation: duplicate key `id` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment