changeset 1550:daf71c76707e

Postgres deadlock triggers unlimited retry
author Adam Chlipala <adam@chlipala.net>
date Sun, 28 Aug 2011 14:01:41 -0400 (2011-08-28)
parents 355a928871ff
children 5175bed443f9
files src/postgres.sml
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/postgres.sml	Fri Aug 26 09:51:38 2011 -0400
+++ b/src/postgres.sml	Sun Aug 28 14:01:41 2011 -0400
@@ -754,6 +754,14 @@
                    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,