summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-02 13:31:13 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-02 13:31:13 -0400
commit0239a9fe128d261f7abeaedc61414d68db985358 (patch)
tree559c927fae65027308b8546ca6cb0e4758e7a2ef
parent410f5f902ea5b94ef79c8c4e01fd2eb35a971184 (diff)
Detect serialization failures
-rw-r--r--src/cjr_print.sml10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/cjr_print.sml b/src/cjr_print.sml
index 96f60887..9c652d4a 100644
--- a/src/cjr_print.sml
+++ b/src/cjr_print.sml
@@ -1645,7 +1645,15 @@ fun p_exp' par env (e, loc) =
string "if (PQresultStatus(res) != PGRES_COMMAND_OK) {",
newline,
- box [string "PQclear(res);",
+ box [string "if (!strcmp(PQresultErrorField(res, PG_DIAG_SQLSTATE), \"40001\")) {",
+ box [newline,
+ string "PQclear(res);",
+ newline,
+ string "uw_error(ctx, UNLIMITED_RETRY, \"Serialization failure\");",
+ newline],
+ string "}",
+ newline,
+ string "PQclear(res);",
newline,
string "uw_error(ctx, FATAL, \"",
string (ErrorMsg.spanToString loc),