Re: dblink_error_message return value

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, realyota(at)gmail(dot)com
Cc: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: dblink_error_message return value
Date: 2018-09-25 17:50:11
Message-ID: 1f9d1514-f087-1b11-9b45-aac91e57bdc2@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On 08/08/2018 11:57 AM, Tom Lane wrote:
> =?utf-8?q?PG_Doc_comments_form?= <noreply(at)postgresql(dot)org> writes:
>> The following documentation comment has been logged on the website:
>> Documentation says:
>
>> Return Value
>> Returns last error message, or an empty string if there has been no error in
>> this connection.
>> Which is invalid.
>> Actually it returns 'OK' string if no error was raised.
>
> Good catch! The code's quite clear about it, but the SGML docs need
> fixed.

As mentioned on the nearby thread, will fix. I suppose this ought to be
back-patched.

>> Secondly
>> dblink_is_busy must be first called to make dblink_error_message returns an
>> error message. (Tested on 9.6.9)
>
> Meh. I see what you're getting at here, I think, but that seems like a
> completely wrong/misleading statement of the issue. Joe, can you think of
> better phraseology?

Maybe a note, something like this?
------------
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.
------------

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Joe Conway 2018-09-25 18:52:45 Re: dblink_get_result returns NULL if remote query throws error
Previous Message Joe Conway 2018-09-25 17:06:09 Re: dblink_get_result returns NULL if remote query throws error