| От | Tom Lane |
|---|---|
| Тема | Re: can we use PQstatus for knowing connection status |
| Дата | |
| Msg-id | 8257.1056030809@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | can we use PQstatus for knowing connection status (HK <harikrishnan@midascomm.com>) |
| Список | pgsql-novice |
HK <harikrishnan@midascomm.com> writes:
> I am using libpq for connecting from a C program to postgres
> 7.1.3. And i am using asyncronous query processing. Suppose i sent a query
> and while processing is on, the postmaster is stopped (for simulating a pg
> crash). Now if i use the PQstatus (conn) i am unable to get the actual
> status. It still says the connection is OK. Then how can we detect the pg
> crash.
You can't, in most scenarios, except by issuing a query and having it
fail. PQstatus will go to CONNECTION_BAD when libpq detects loss of
connection ... but it wouldn't be very reasonable or useful to have the
library constantly pinging the server to verify the connection is still
up.
regards, tom lane
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера