Re: How to force disconnections from a Perl script? - Mailing list pgsql-general

From Csaba Nagy
Subject Re: How to force disconnections from a Perl script?
Date
Msg-id 1171903974.3101.300.camel@coppola.muc.ecircle.de
Whole thread Raw
In response to Re: How to force disconnections from a Perl script?  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: How to force disconnections from a Perl script?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
> Why irrecoverably? If the command fails, you just wait and try it
> again.

> You could use the pg_stat tables to work out who is connected and use
> pg_cancel_backend() to kill them. You could "kill -INT" them yourself.
> You could change the pg_hba.conf to forbid logging in and then bouncing
> the server.


I was going to suggest the same things you did, but then I thought
better... the OP is running the thing at night from a client box, not on
the DB, so restart and process listing is probably off limits...

There's 0 chance somebody will close at midnight it's open connection
forgotten when he left office, so wait and retry would not do any good
;-)

And pg_stat will only show you running queries, not the idle
connections.

If you only could list all the connection's pids in a client you could
loop and kill them all. Of course the loop would kill itself too if not
careful enough ;-)

Cheers,
Csaba.





pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: How to force disconnections from a Perl script?
Next
From: Vivek Khera
Date:
Subject: Re: open source - content management system - that uses PostGreSQL