diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-04-02 13:31:13 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-04-02 13:31:13 -0400 |
commit | c304fcda63a1c797c375da3817cefd127055b35b (patch) | |
tree | 559c927fae65027308b8546ca6cb0e4758e7a2ef /src | |
parent | ec0e365e2faa26e78a7fa7b81cbf941f5545ef1a (diff) |
Detect serialization failures
Diffstat (limited to 'src')
-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), |