Re: pg_connect sometimes works sometimes not - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: pg_connect sometimes works sometimes not
Date
Msg-id 20070425150353.GA15706@svana.org
Whole thread Raw
In response to Re: pg_connect sometimes works sometimes not  ("pobox@verysmall.org" <pobox@verysmall.org>)
List pgsql-general
On Wed, Apr 25, 2007 at 04:50:46PM +0200, pobox@verysmall.org wrote:
> Richard Huxton wrote:
> >pobox@verysmall.org wrote:
> >>What other variable (which are sometimes there, sometimes not) reasons
> >>there can be pg_connect to fail?
> >
> >What result-code/error do you get? What do your logs show?
>
> I have -
>
> $connection = pg_connect("$host $db $user $pass");
>
> When I get the error it is because $connection is 'false'.
>
> Thought of using pg_result_error - but it seems applicable only to
> queries (i.e. with pg_query or pg_execute). How can I get an error code?

In the C interface it's called PQerrorMessage(). I'm sure PHP has an
equivalent.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: "pobox@verysmall.org"
Date:
Subject: Re: pg_connect sometimes works sometimes not
Next
From: Manuel Sugawara
Date:
Subject: Re: Audit-trail engine: getting the application's layer user_id