diff --git a/NEWS b/NEWS index 0b71653f..86751c4f 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ Current release What's new in psycopg 2.6.1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +- Correctly unlock the connection after error in flush (:ticket:`#294`). - Fixed ``MinTimeLoggingCursor.callproc()`` (:ticket:`#309`). diff --git a/psycopg/pqpath.c b/psycopg/pqpath.c index c4b5528d..5e1974be 100644 --- a/psycopg/pqpath.c +++ b/psycopg/pqpath.c @@ -980,6 +980,10 @@ pq_execute(cursorObject *curs, const char *query, int async, int no_result, int } else { /* there was an error */ + pthread_mutex_unlock(&(curs->conn->lock)); + Py_BLOCK_THREADS; + PyErr_SetString(OperationalError, + PQerrorMessage(curs->conn->pgconn)); return -1; } }