Marco Bambini wrote:
> I have a multithreaded C client and sometimes I receive the "no connection to the server" error
> message.
> I haven't found any documentation about it and about how to fix this issue.
>
> Anyone can point me to the right direction?
The error message is reported in interfaces/libpq/fe-exec.c:
static bool
PQsendQueryStart(PGconn *conn)
{
if (!conn)
return false;
/* clear the error string */
resetPQExpBuffer(&conn->errorMessage);
/* Don't try to send if we know there's no live connection. */
if (conn->status != CONNECTION_OK)
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("no connection to the server\n"));
return false;
}
So it looks like you closed the connection (maybe in some other thread)
and then try to reuse it.
Yours,
Laurenz Albe