Skip to content

Instantly share code, notes, and snippets.

@tamird
Last active August 29, 2015 14:28
Show Gist options
  • Save tamird/0662f3b0997a89b37a12 to your computer and use it in GitHub Desktop.
Save tamird/0662f3b0997a89b37a12 to your computer and use it in GitHub Desktop.
TXN 1 TXN 2
test=# begin; test=# begin;
BEGIN BEGIN
test=# SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; test=# SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SET SET
test=# update kv set v = 'b' where k = 'a';
UPDATE 1
                                                |test=# update kv set v = 'a' where k = 'a';

test=# select * from kv; | ... | test=# commit; | COMMIT | |ERROR: could not serialize access due to concurrent update |test=# select * from kv; |ERROR: current transaction is aborted, commands ignored until end of transaction block |test=# commit; |ROLLBACK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment