diff --git a/psycopg/pqpath.c b/psycopg/pqpath.c index 83ab91f20..7b5342b9d 100644 --- a/psycopg/pqpath.c +++ b/psycopg/pqpath.c @@ -412,6 +412,7 @@ pq_commit(connectionObject *conn) } Py_BLOCK_THREADS; + conn_notifies_process(conn); conn_notice_process(conn); Py_UNBLOCK_THREADS; diff --git a/tests/test_notify.py b/tests/test_notify.py index 03ab4cde2..27bcba611 100755 --- a/tests/test_notify.py +++ b/tests/test_notify.py @@ -126,6 +126,18 @@ def test_notifies_received_on_execute(self): self.assertEqual(pid, self.conn.notifies[0][0]) self.assertEqual('foo', self.conn.notifies[0][1]) + @slow + def test_notifies_received_on_commit(self): + self.listen("foo") + self.conn.commit() + self.conn.cursor().execute("select 1;") + pid = int(self.notify("foo").communicate()[0]) + self.assertEqual(0, len(self.conn.notifies)) + self.conn.commit() + self.assertEqual(1, len(self.conn.notifies)) + self.assertEqual(pid, self.conn.notifies[0][0]) + self.assertEqual("foo", self.conn.notifies[0][1]) + @slow def test_notify_object(self): self.autocommit(self.conn)