Re: Fwd: [LibPQ] Trying PQconnectStart: it doesn't seem to connect - Mailing list pgsql-general

From Daniel Verite
Subject Re: Fwd: [LibPQ] Trying PQconnectStart: it doesn't seem to connect
Date
Msg-id 9fc66c8b-c8de-48da-9ef7-d9bc7b7d1da7@mm
Whole thread Raw
In response to Fwd: [LibPQ] Trying PQconnectStart: it doesn't seem to connect  (Alessandro Agosto <the.6one6@gmail.com>)
Responses Re: Fwd: [LibPQ] Trying PQconnectStart: it doesn't seem to connect  (Alessandro Agosto <the.6one6@gmail.com>)
List pgsql-general
    Alessandro Agosto wrote:

> I'm not yet within select/poll cycle, this is the first call that should
> return CONNECTION_OK or CONNECTION_BAD (refering to docs).

That would be the behavior of PQconnectdb(), not PQconnectStart().

Have you read that part of the doc:

<quote>
Other states might also occur during (and only during) an asynchronous
connection procedure. These indicate the current stage of the connection
procedure and might be useful to provide feedback to the user for example.
These statuses are:

CONNECTION_STARTED

    Waiting for connection to be made.
CONNECTION_MADE

    Connection OK; waiting to send.
CONNECTION_AWAITING_RESPONSE

    Waiting for a response from the server.
CONNECTION_AUTH_OK

    Received authentication; waiting for backend start-up to finish.
CONNECTION_SSL_STARTUP

    Negotiating SSL encryption.
CONNECTION_SETENV

    Negotiating environment-driven parameter settings.

Note that, although these constants will remain (in order to maintain
compatibility), an application should never rely upon these occurring in a
particular order, or at all, or on the status always being one of these
documented values. An application might do something like this:

switch(PQstatus(conn))
{
    case CONNECTION_STARTED:
        feedback = "Connecting...";
        break;

    case CONNECTION_MADE:
        feedback = "Connected to server...";
        break;

pgsql-general by date:

Previous
From: Alessandro Agosto
Date:
Subject: Fwd: [LibPQ] Trying PQconnectStart: it doesn't seem to connect
Next
From: Tom Lane
Date:
Subject: Re: \dt+ sizes don't include TOAST data