Re: PQstatus() detect change in connection...

Поиск
Список
Период
Сортировка
От Zeugswetter Andreas SB SD
Тема Re: PQstatus() detect change in connection...
Дата
Msg-id 46C15C39FEB2C44BA555E356FBCD6FA41EB3CF@m0114.s-mxs.net
обсуждение исходный текст
Ответ на PQstatus() detect change in connection...  (Matthew Hagerty <mhagerty@voyager.net>)
Список pgsql-hackers
> Matthew Hagerty <mhagerty@voyager.net> writes:
> > but I also want to check the connection *before* submitting a
query...

If you mean directly before the query, then forget it, as Tom already
said :-)

> This strikes me as utterly pointless.  You'll need to be able to
recover
> from query failure anyway, so what's the value of testing beforehand?
> Send the query and see if it works or not.

I see a value in checking connection status before you start doing
loads of local work after a long idle time, that results in a query.
In this situation I guess it is good enough to send an empty query
even if it takes a little.

In our projects we recv 0 bytes from the socket every x seconds
during long idle periods to detect connection problems early.
While it is not 100% reliable (since it does not transfer
anything over the network) it does detect some common error situations.

I am not 100% sure, but I think PQstatus could be patched to do that.

Andreas


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

Предыдущее
От: Lee Kindness
Дата:
Сообщение: Compiling on Solaris with Sun compiler
Следующее
От: Vince Vielhaber
Дата:
Сообщение: Re: Snaptshot appears fine to me ...