Add a cancel() method do the connection object that will interrupt the current query using the libpq PQcancel() function.