Roundup Tracker - Issues

Issue 2086536

Title: back_postgresql: fixing pg_command and prefering psycopg2
Type: Severity: normal
Components: Database Versions:
Status: fixed Resolution: fixed
Dependencies: Superseder:
Assigned To: richard Nosy List: mephinet, richard, rouilj
Priority: normal Keywords: patch

Created on 2008-09-01 10:10 by mephinet, last changed 2016-07-03 01:17 by rouilj.

File name Uploaded Description Edit Remove
back_postgresql.patch mephinet, 2008-09-01 10:10 patch for roundup/backends/
msg2938 Author: [hidden] (mephinet) Date: 2008-09-01 10:10
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.
msg5722 Author: [hidden] (rouilj) Date: 2016-07-03 01:17
Applied in changeset: 57452bc6d989

I modified it a bit to remove support for psycopg1 entirely.

for discussion supporting this.

The test suite Postgres tests still pass so....
Date User Action Args
2016-07-03 01:17:51rouiljsetstatus: open -> fixed
resolution: fixed
messages: + msg5722
nosy: + rouilj
2008-09-01 10:10:43mephinetcreate