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.