Skip to content

Commit bc6d7eb

Browse files
committed
Fix documentation for dblink_error_message() return value
The dblink documentation claims that an empty string is returned if there has been no error, however OK is actually returned in that case. Also, clarify that an async error may not be seen unless dblink_is_busy() or dblink_get_result() have been called first. Backpatch to all supported branches. Reported-by: realyota Backpatch-through: 9.4 Discussion: https://postgr.es/m/[email protected]
1 parent a32ca78 commit bc6d7eb

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

doc/src/sgml/dblink.sgml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,11 +1165,25 @@ dblink_error_message(text connname) returns text
11651165
<title>Return Value</title>
11661166

11671167
<para>
1168-
Returns last error message, or an empty string if there has been
1168+
Returns last error message, or <literal>OK</literal> if there has been
11691169
no error in this connection.
11701170
</para>
11711171
</refsect1>
11721172

1173+
<refsect1>
1174+
<title>Notes</title>
1175+
1176+
<para>
1177+
When asynchronous queries are initiated by
1178+
<function>dblink_send_query</function>, the error message associated with
1179+
the connection might not get updated until the server's response message
1180+
is consumed. This typically means that <function>dblink_is_busy</function>
1181+
or <function>dblink_get_result</function> should be called prior to
1182+
<function>dblink_error_message</function>, so that any error generated by
1183+
the asynchronous query will be visible.
1184+
</para>
1185+
</refsect1>
1186+
11731187
<refsect1>
11741188
<title>Examples</title>
11751189

0 commit comments

Comments
 (0)