summaryrefslogtreecommitdiff
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
commit76a36bc094b4939ed4d689c59c692154289f1ca5 (patch)
tree549acb4e107f7bbc18990a4b002ab38b1e119cf1
parent531d9f2a01598e1952e77bfaa156a0b0de7b74a3 (diff)
Postgres deadlock triggers unlimited retry
-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,