| От | Tom Lane |
|---|---|
| Тема | Re: PQstatus does not seem to work |
| Дата | |
| Msg-id | 12473.1249923710@sss.pgh.pa.us обсуждение |
| Ответ на | PQstatus does not seem to work (Juan Backson <juanbackson@gmail.com>) |
| Список | pgsql-general |
Juan Backson <juanbackson@gmail.com> writes:
> 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?
PQstatus isn't going to get updated until you try to do some operation
with the connection object. Otherwise it wouldn't be a simple inquiry
function, but some exceedingly expensive operation involving attempting
to contact the server.
> What other solution is available to check whether a connection is still
> alive?
Send a query.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера