Roundup Tracker - Issues

Message2938

Author mephinet
Recipients
Date 2008-09-01.10:10:43
Message-id
In-reply-to
The attached patch fixes the following problems in back_postgresql.pg_command:

* When calling `execute` on the database, only ProgrammingError is being catched - 
even though most errors are reported by pyscopg as OperationalError
(see psycopg/pqpath.c). Especially, all errors reported by the database when executing
a query are wrapped into an OperationalError:

if (PQstatus(curs->conn->pgconn) != CONNECTION_OK) {
    ...
    PyErr_SetString(OperationalError, PQerrorMessage(curs->conn->pgconn));
    ...

Therefore, in my opinion, the exception handler has to catch both exception classes, 
or their common superclass, DatabaseError.

* When looking at the exception handler, there is a list of messages - and in case
one of the messages is in the exception message, a retry might help.
What the code does, however, is to return a "retry" if any of the messages
*does not* match - which will always be the case.

Furthermore, if both version 1 and version 2 of psycopg is installed, version 2 is preferred.
History
Date User Action Args
2009-02-03 14:23:19adminlinkissue2086536 messages
2009-02-03 14:23:19admincreate