summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Henstridge <james@jamesh.id.au>2008-03-06 18:41:07 +0000
committerJames Henstridge <james@jamesh.id.au>2008-03-06 18:41:07 +0000
commit475df5ebd6bc8b83b32f7267d8f5004b6443c4e0 (patch)
tree5b2d9568e76c8a345efce2b852992a129104d4d1
parent89cadcb55303ac5457e60b87f4c977a4405fa1b0 (diff)
downloadpsycopg2-475df5ebd6bc8b83b32f7267d8f5004b6443c4e0.tar.gz
2008-03-07 Jason Erickson <jerickso@stickpeople.com>
* psycopg/pqpath.c (pq_raise): if PSYCOPG_EXTENSIONS is not defined, raise OperationalError rather than TransactionRollbackError for deadlock or serialisation errors for protocol versions less than 3.
-rw-r--r--ChangeLog4
-rw-r--r--psycopg/pqpath.c4
2 files changed, 8 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b50cd7d..834b2bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2008-03-07 Jason Erickson <jerickso@stickpeople.com>
+ * psycopg/pqpath.c (pq_raise): if PSYCOPG_EXTENSIONS is not
+ defined, raise OperationalError rather than
+ TransactionRollbackError for deadlock or serialisation errors.
+
* psycopg/psycopgmodule.c (psyco_connect): fix off by one error in
calculating the length of the DSN.
diff --git a/psycopg/pqpath.c b/psycopg/pqpath.c
index 54263bc..14eecd2 100644
--- a/psycopg/pqpath.c
+++ b/psycopg/pqpath.c
@@ -196,7 +196,11 @@ pq_raise(connectionObject *conn, cursorObject *curs, PGresult *pgres)
exc = IntegrityError;
else if (strstr(err, "could not serialize") ||
strstr(err, "deadlock detected"))
+#ifdef PSYCOPG_EXTENSIONS
exc = TransactionRollbackError;
+#else
+ exc = OperationalError;
+#endif
else
exc = ProgrammingError;
}