From 4910f53b7eb33580fcc97f0fad746071f5806839 Mon Sep 17 00:00:00 2001 From: James Henstridge Date: Wed, 19 Dec 2007 14:33:44 +0000 Subject: [PATCH] * psycopg/pqpath.c (pq_execute): uncomment the "curs->pgres == NULL" error handler after the PQexec() call. This is needed to catch database disconnects (and probably other errors). According to Federico, it was commented out to avoid a spurious error, so we should watch for problems. --- ChangeLog | 8 ++++++++ psycopg/pqpath.c | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 34d07317..b31750b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-12-20 James Henstridge + + * psycopg/pqpath.c (pq_execute): uncomment the "curs->pgres == + NULL" error handler after the PQexec() call. This is needed to + catch database disconnects (and probably other errors). According + to Federico, it was commented out to avoid a spurious error, so we + should watch for problems. + 2007-12-20 James Henstridge * psycopg/pqpath.c (pq_raise): only remove the first 8 characters diff --git a/psycopg/pqpath.c b/psycopg/pqpath.c index c33a3b8a..46fde60b 100644 --- a/psycopg/pqpath.c +++ b/psycopg/pqpath.c @@ -456,14 +456,13 @@ pq_execute(cursorObject *curs, const char *query, int async) curs->pgres = PQexec(curs->conn->pgconn, query); /* dont let pgres = NULL go to pq_fetch() */ - /* if (curs->pgres == NULL) { + if (curs->pgres == NULL) { pthread_mutex_unlock(&(curs->conn->lock)); Py_BLOCK_THREADS; PyErr_SetString(OperationalError, PQerrorMessage(curs->conn->pgconn)); return -1; } - */ } else if (async == 1) {