30th September 2021: PostgreSQL 14 Released!
Supported Versions: Current (14) / 13 / 12 / 11 / 10 / 9.6
Development Versions: devel
Unsupported versions: 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3



dblink_cancel_query -- cancels any active query on the named connection


dblink_cancel_query(text connname) returns text


dblink_cancel_query attempts to cancel any query that is in progress on the named connection. Note that this is not certain to succeed (since, for example, the remote query might already have finished). A cancel request simply improves the odds that the query will fail soon. You must still complete the normal query protocol, for example by calling dblink_get_result.



Name of the connection to use.

Return Value

Returns OK if the cancel request has been sent, or the text of an error message on failure.


SELECT dblink_cancel_query('dtest1');

Submit correction

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.