Created
February 8, 2016 18:14
-
-
Save begriffs/5729026cfa86e731e093 to your computer and use it in GitHub Desktop.
simplified deadlock test
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
| module Main where | |
| import Control.Monad (replicateM_) | |
| import Hasql.Connection | |
| import Hasql.Session | |
| import Hasql.Query | |
| main :: IO () | |
| main = do | |
| acquire "postgres://postgres@localhost:5432/demo1" >>= \case | |
| Left err -> error $ show err | |
| Right c -> | |
| replicateM_ 10 $ run sess c | |
| where | |
| sess = do | |
| sql "begin isolation level read committed;" | |
| sql "WITH pg_source AS (UPDATE \"public\".\"film\" SET \"rating\"='1'::unknown WHERE \"public\".\"film\".\"id\" = '1'::unknown ) SELECT '', 0, '', '';" | |
| sql "WITH pg_source AS (UPDATE \"public\".\"film\" SET \"rating\"='1'::unknown WHERE \"public\".\"film\".\"id\" = '1'::unknown ) SELECT '', 0, '', '';" | |
| sql "commit;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment