diff options
author | 2009-04-02 13:31:13 -0400 | |
---|---|---|
committer | 2009-04-02 13:31:13 -0400 | |
commit | c304fcda63a1c797c375da3817cefd127055b35b (patch) | |
tree | 559c927fae65027308b8546ca6cb0e4758e7a2ef | |
parent | ec0e365e2faa26e78a7fa7b81cbf941f5545ef1a (diff) |
Detect serialization failures
-rw-r--r-- | src/cjr_print.sml | 10 |
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), |