dblink\_send\_query

|           dblink\_send\_query           |                 |            |                  |                                    |
|:---------------------------------------:|-----------------|------------|------------------|------------------------------------|
|[Prev](contrib-dblink-error-message.html)|[Up](dblink.html)|F.10. dblink|[Home](index.html)| [Next](contrib-dblink-is-busy.html)|

---

[]()

## dblink\_send\_query

dblink\_send\_query — sends an async query to a remote database

## Synopsis

```
dblink_send_query(text connname, text sql) returns int

```

## Description

`dblink_send_query` sends a query to be executed asynchronously, that is, without immediately waiting for the result. There must not be an async query already in progress on the connection.

 After successfully dispatching an async query, completion status can be checked with `dblink_is_busy`, and the results are ultimately collected with `dblink_get_result`. It is also possible to attempt to cancel an active async query using `dblink_cancel_query`.

## Arguments

*`connname`*

 Name of the connection to use.

*`sql`*

 The SQL statement that you wish to execute in the remote database, for example `select * from pg_class`.

## Return Value

 Returns 1 if the query was successfully dispatched, 0 otherwise.

## Examples

```
SELECT dblink_send_query('dtest1', 'SELECT * FROM foo WHERE f1 < 3');

```

---

|[Prev](contrib-dblink-error-message.html)|[Up](dblink.html) | [Next](contrib-dblink-is-busy.html)|
|:----------------------------------------|:----------------:|-----------------------------------:|
|         dblink\_error\_message          |[Home](index.html)|          dblink\_is\_busy          |

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>