diff src/postgres.sml @ 1550:daf71c76707e

Postgres deadlock triggers unlimited retry
author Adam Chlipala <adam@chlipala.net>
date Sun, 28 Aug 2011 14:01:41 -0400
parents 969b90b1f2f9
children da11f7b18067
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,