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

From: "Zeugswetter Andreas SB SD" <ZeugswetterA(at)spardat(dot)at>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Matthew Hagerty" <mhagerty(at)voyager(dot)net>
Cc: "Mark Pritchard" <mark(at)tangent(dot)net(dot)au>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PQstatus() detect change in connection...
Date: 2001-10-19 10:04:39
Message-ID: 46C15C39FEB2C44BA555E356FBCD6FA41EB3CF@m0114.s-mxs.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> Matthew Hagerty <mhagerty(at)voyager(dot)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

Browse pgsql-hackers by date

  From Date Subject
Next Message Vince Vielhaber 2001-10-19 10:43:28 Re: Snaptshot appears fine to me ...
Previous Message Lee Kindness 2001-10-19 08:40:53 Compiling on Solaris with Sun compiler