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

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Daniel Frey <d(dot)frey(at)gmx(dot)de>, 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 16:00:53
Message-ID: d02a6212477706119f804b9206c32554c77e45fa.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2021-12-03 at 11:37 +0100, Daniel Frey wrote:
> I need to know which functions of libpq may "hang", depending on network issues. For some functions is
> seems to be clear, as they only work locally, other functions are clearly documented to wait on some
> network interaction. But for some functions, it is unclear on whether they are guaranteed to work
> locally without any possibility to hang or not, e.g. PQfinish(), PQstatus(), PQtransactionStatus(), etc.
>
> Is there a complete list of methods that might wait for network communication?

No; you have to read the code.

For example, PGstatus is defined like this:

PQstatus(const PGconn *conn)
{
if (!conn)
return CONNECTION_BAD;
return conn->status;
}

This does not access the network.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sebastien Flaesch 2021-12-03 16:08:42 Re: SUM() of INTERVAL type produces INTERVAL with no precision
Previous Message Tom Lane 2021-12-03 15:32:03 Re: Max connections reached without max connections reached