Re: Error: no connection to the server - Mailing list pgsql-general

From Albe Laurenz
Subject Re: Error: no connection to the server
Date
Msg-id A737B7A37273E048B164557ADEF4A58B53844008@ntex2010i.host.magwien.gv.at
Whole thread Raw
In response to Error: no connection to the server  (Marco Bambini <marco@sqlabs.com>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Marco Bambini
Date:
Subject: Error: no connection to the server
Next
From: David Wilson
Date:
Subject: Re: Background worker plus language handler for Andl: OK?