Re: connection watchdog

From: "Shridhar Daithankar" <shridhar_daithankar(at)persistent(dot)co(dot)in>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: connection watchdog
Date: 2002-10-10 14:52:17
Message-ID: 3DA5E179.1343.527B6FC@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Roberto (SmartBit) 2002-10-10 14:57:31 Re: Getting tables, procedures, etc.
Previous Message shey sewani 2002-10-10 14:45:48 Re: DTOI4 integer out of range