summaryrefslogtreecommitdiff
path: root/src/postgres.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-08-28 14:01:41 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2011-08-28 14:01:41 -0400
commit15ae1d4983d29b4268c3bcb25e291fe7bf1c33fc (patch)
tree549acb4e107f7bbc18990a4b002ab38b1e119cf1 /src/postgres.sml
parenta118306d4028d487136aeec92e4c328b1d8f695b (diff)
Postgres deadlock triggers unlimited retry
Diffstat (limited to 'src/postgres.sml')
-rw-r--r--src/postgres.sml8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/postgres.sml b/src/postgres.sml
index 9b64935c..9707096f 100644
--- a/src/postgres.sml
+++ b/src/postgres.sml
@@ -754,6 +754,14 @@ fun dmlCommon {loc, dml, mode} =
newline],
string "}",
newline,
+ string "if (!strcmp(PQresultErrorField(res, PG_DIAG_SQLSTATE), \"40P01\")) {",
+ box [newline,
+ string "PQclear(res);",
+ newline,
+ string "uw_error(ctx, UNLIMITED_RETRY, \"Deadlock detected\");",
+ newline],
+ string "}",
+ newline,
case mode of
Settings.Error => box [string "PQclear(res);",
newline,