# dblink\_cancel\_query

dblink\_cancel\_query — cancels any active query on the named connection

### Synopsis

```
dblink_cancel_query(text connname) returns text
```

### Description

`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`.

### Arguments

*`connname`*

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.

### Examples

```
SELECT dblink_cancel_query('dtest1');
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.postgresql.tw/13/appendixes/additional-supplied-modules/dblink/dblink_cancel_query.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
