Re: pg_connect sometimes works sometimes not

Поиск
Список
Период
Сортировка
Искать
От
Richard Huxton
Тема
Re: pg_connect sometimes works sometimes not
Дата
Msg-id
462F6C2D.3010700@archonet.com
Ответ на
Список
Дерево обсуждения
pg_connect sometimes works sometimes not "pobox@verysmall.org" <pobox@verysmall.org>
Re: pg_connect sometimes works sometimes not Richard Huxton <dev@archonet.com>
Re: pg_connect sometimes works sometimes not "pobox@verysmall.org" <pobox@verysmall.org>
Re: pg_connect sometimes works sometimes not Martijn van Oosterhout <kleptog@svana.org>
Re: pg_connect sometimes works sometimes not Richard Huxton <dev@archonet.com>
Re: pg_connect sometimes works sometimes not "pobox@verysmall.org" <pobox@verysmall.org>
Re: pg_connect sometimes works sometimes not "pobox@verysmall.org" <pobox@verysmall.org>
Re: pg_connect sometimes works sometimes not Richard Huxton <dev@archonet.com>
Re: pg_connect sometimes works sometimes not "pobox@verysmall.org" <pobox@verysmall.org>
Re: pg_connect sometimes works sometimes not Raymond O'Donnell <rod@iol.ie>
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?

Did you try pg_last_error()?

> PostgreSQL is instructed to log into the syslog, which is 
> /var/log/messages. There are only two type of things there from today -
> 
> [1-1] WARNING: nonstandard use of \\ in a string literal at character XXX
> 
> [1-2] HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
> 
> But it does not seem like any of these are related to pg_connect, or am 
> I wrong (I guess they are related to bad code somewhere).

Are you logging connection attempts/failures? Details in the manuals.

-- 
   Richard Huxton
   Archonet Ltd
В списке pgsql-general по дате отправления
От: Andrew Dunstan
Дата:
От: Raymond O'Donnell
Дата:
FAQ