---
name: "dblink_error_message"
section: "3"
platform: "linux"
package: "postgresql"
version: "18.6-4"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/dblink_error_message"
---

# dblink\_error\_message(3)

gets last error message on the named connection

## NAME

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');
```
