Re: PQstatus does not seem to work

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: PQstatus does not seem to work
Дата
Msg-id 20090810170815.GV5407@samason.me.uk
обсуждение исходный текст
Ответ на PQstatus does not seem to work  (Juan Backson <juanbackson@gmail.com>)
Ответы Re: PQstatus does not seem to work
Список pgsql-general
On Tue, Aug 11, 2009 at 12:41:47AM +0800, Juan Backson wrote:
> I used PQstatus(conn) function to check connection status, but I found that
> it still returns CONNECTION_OK even after postgres is restarted.  Does
> anyone know if there is another command that I can use to check connection
> status?

Yes, PQstatus just gives back the last status.  It doesn't go off and
check anything.

> What other solution is available to check whether a connection is still
> alive?

As a connection can go down at any time, this doesn't seem useful.  Just
send off your request as normal and if it fails because the connection
was closed then you can open a new one and try again.

--
  Sam  http://samason.me.uk/

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PQstatus does not seem to work
Следующее
От: Vick Khera
Дата:
Сообщение: Re: Postgres memory question