Re: libpq: Which functions may hang due to network issues?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Frey <d(dot)frey(at)gmx(dot)de>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: libpq: Which functions may hang due to network issues?
Date: 2021-12-03 17:14:21
Message-ID: 2311007.1638551661@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Daniel Frey <d(dot)frey(at)gmx(dot)de> writes:
>> On 3. Dec 2021, at 17:00, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
>> On Fri, 2021-12-03 at 11:37 +0100, Daniel Frey wrote:
>>> Is there a complete list of methods that might wait for network communication?

>> No; you have to read the code.

> I feel that this is insufficient, as the code might change. And it might be simple enought for something like PQstatus(), but not all functions are that simple.

> If this property of a function is not guaranteed by the documentation, how am I expected to write a library that doesn't depend on a specific version of libpq? Could these guarantees be added to the documentation, please?

No. For one thing, we'd probably forget to maintain any such info.
In any case, I think you'd be best off to assume that anything that
isn't purely local state inspection might try to contact the server.
And it's not hard to see which ones are local state inspection.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Gauthier 2021-12-03 20:13:52 Insert binary file into bytea where PG server does not have access to the file ?
Previous Message Sebastien Flaesch 2021-12-03 16:45:58 Re: SUM() of INTERVAL type produces INTERVAL with no precision