Re: connection watchdog - Mailing list pgsql-general

From Shridhar Daithankar
Subject Re: connection watchdog
Date
Msg-id 3DA5E179.1343.527B6FC@localhost
Whole thread Raw
In response to connection watchdog  (Michael Kichanov <mike@nordlink.ru>)
Responses Re: connection watchdog  (Michael Kichanov <mike@nordlink.ru>)
List pgsql-general
On 10 Oct 2002 at 18:45, Michael Kichanov wrote:

> Hi Postgres gurus!
>
> How can I check from C-program whether connection to pgsql
> engine still works or already lost?
> PQstatus() returns CONNECTION_OK even when backend process is killed
> by hands after connection is made.

There is a function which returns fd of the connection to postgresql database.
If you install a SIGPIPE handler on that connections, perhaps you can catch the
signal that backend is killed. But you will get that signal only when you
attempt to write to the  fd, according to 'man 7 signal' on my mandrake box.

Just theory. Try it out and let us know if it works..

HTH


Bye
 Shridhar

--
Preudhomme's Law of Window Cleaning:    It's on the other side.


pgsql-general by date:

Previous
From: Joe Conway
Date:
Subject: Re: encryption
Next
From: "Roberto (SmartBit)"
Date:
Subject: Re: Getting tables, procedures, etc.