contrib-dblink-error-message.md 892 字节
Newer Older
K
KyleZhang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
## dblink\_error\_message

dblink\_error\_message — gets last error message on the named connection

## Synopsis

```
dblink_error_message(text connname) returns text

```

## Description

`dblink_error_message` fetches the most recent remote error message for a given connection.

## Arguments

*`connname`*

 Name of the connection to use.

## Return Value

 Returns last error message, or `OK` if there has been no error in this connection.

## Notes

 When asynchronous queries are initiated by `dblink_send_query`, the error message associated with the connection might not get updated until the server's response message is consumed. This typically means that `dblink_is_busy` or `dblink_get_result` should be called prior to `dblink_error_message`, so that any error generated by the asynchronous query will be visible.

## Examples

```
SELECT dblink_error_message('dtest1');

```