Re: PQstatus() detect change in connection... - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PQstatus() detect change in connection...
Date
Msg-id 24856.1003428619@sss.pgh.pa.us
Whole thread Raw
In response to Re: PQstatus() detect change in connection...  (Matthew Hagerty <mhagerty@voyager.net>)
Responses Re: PQstatus() detect change in connection...
List pgsql-hackers
Matthew Hagerty <mhagerty@voyager.net> writes:
> Anyone know a good *fast* way to test 
> if a socket is still valid?

What exactly are you trying to defend against?

In general, I don't believe that there is any way of discovering whether
the server is still up, other than to send it a query.  (FWIW, an empty
query string bounces back very quickly, with little processing.)

For particular scenarios it's possible that some notification has been
delivered to the client, but if you have had (say) a loss of network
connectivity then there just is no other alternative.  Your end isn't
going to discover the connectivity loss until it tries to send a
message.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_sorttemp files
Next
From: Bill Studenmund
Date:
Subject: Re: Package support for Postgres