pg_cancelrequest — Cancel an in-progress asynchronous query


pg_cancelrequest conn


pg_cancelrequest asks the database server to abandon processing of the current command issued by pg_sendquery.



The handle of the connection on which to cancel the current command.

Return Value

Nothing. Throws a Tcl error if an error occurs.


There is no guarantee that the command will actually be canceled. For example, the command may have been completed before the database server can receive and handle the cancel request. If a request is canceled, and you were in the middle of a transaction, the entire transaction is rolled back.

You still need to call pg_getresult repeatedly until it doesn't return anything, and deal with all the returned result handles, usually by freeing them with pg_result -clear.

This command uses or emulates the PostgreSQL libpq function PQrequestCancel. Logo

This version of the manual was produced for the Pgtcl-ng Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the Pgtcl-ng project downloads area.