DBLINK_ERROR_MESSAGE(3)

πŸ“¦ version 13.23, in opensuse-leap 16.0

okay so bestie, we're in the dblink_error_message era of the PostgreSQL 13.23 Documentation and honestly? this one is a little lifesaver 🫢


✨ NAME ✨

dblink_error_message β€” the function that grabs the last error message on the named connection πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

dblink_error_message(text connname) returns text

πŸ¦‹ DESCRIPTION πŸ¦‹

So like, dblink_error_message fetches the most recent remote error message for a given connection. That's it, that's the whole vibe. You point it at a connection, it hands you back the tea on what went wrong last πŸ”₯


🌸 ARGUMENTS 🌸

  • connname β€” the name of the connection you wanna use, bestie. that's the one.

πŸ’œ RETURN VALUE πŸ’œ

Returns the last error message, or OK if there has been no error in this connection. no drama, no error, just OK ✨


⭐ NOTES ⭐

okay this is the part where you gotta pay attention, because it's giving sneaky πŸ™ˆ

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. lowkey important!!

What that typically means: 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 actually be visible. like, do the steps in order or you'll be out here wondering why your error message is stale πŸ’€


🧚 EXAMPLES 🧚

SELECT dblink_error_message('dtest1');

and that's the whole page, bestie, no cap πŸ“

sign-off era: this iconic little page came to you courtesy of PostgreSQL 13.23, dated 2025, and it's filed under DBLINK_ERROR_MESSAGE(3). slay πŸ’…πŸ’–

πŸ“¦ where this page comes from