diff --git a/psycopg/pqpath.c b/psycopg/pqpath.c index 56dc4e03..a229943a 100644 --- a/psycopg/pqpath.c +++ b/psycopg/pqpath.c @@ -761,8 +761,6 @@ pq_execute(cursorObject *curs, const char *query, int async) pthread_mutex_unlock(&(curs->conn->lock)); Py_END_ALLOW_THREADS; - conn_notice_process(curs->conn); - /* if the execute was sync, we call pq_fetch() immediately, to respect the old DBAPI-2.0 compatible behaviour */ if (async == 0) { diff --git a/tests/test_async.py b/tests/test_async.py index 6f3ec4c0..a4a11b9b 100755 --- a/tests/test_async.py +++ b/tests/test_async.py @@ -388,6 +388,15 @@ class AsyncTests(unittest.TestCase): self.wait(cur2) self.assertEquals(cur2.fetchone()[0], 1) + def test_notices(self): + del self.conn.notices[:] + cur = self.conn.cursor() + cur.execute("create temp table chatty (id serial primary key);") + self.wait(cur) + self.assertEqual("CREATE TABLE", cur.statusmessage) + self.assert_(self.conn.notices) + + def test_suite(): return unittest.TestLoader().loadTestsFromName(__name__) diff --git a/tests/test_connection.py b/tests/test_connection.py index 325d18d9..277616b4 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -37,6 +37,13 @@ class ConnectionTests(unittest.TestCase): # now the isolation level should be equal to saved one self.assertEqual(conn.isolation_level, level) + def test_notices(self): + conn = self.connect() + cur = conn.cursor() + cur.execute("create temp table chatty (id serial primary key);") + self.assertEqual("CREATE TABLE", cur.statusmessage) + self.assert_(conn.notices) + conn.close() def test_suite(): return unittest.TestLoader().loadTestsFromName(__name__)