Postgresql 中文操作指南

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 发送要异步执行的查询,也就是说,不会立即等待结果。连接上不能有正在进行的异步查询。

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.

成功分派异步查询后,可以使用 dblink_is_busy 检查完成状态并最终使用 dblink_get_result 收集结果。也可以尝试使用 dblink_cancel_query 取消活动异步查询。

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

如果成功分派查询,则返回 1,否则返回 0。

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

Examples

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