Re: closing a connection from "outside" an application (for testing)
"Webb Sprague" <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On Jan 5, 2008 8:54 AM, Karsten Hilbert <[email protected]> wrote: > On Sat, Jan 05, 2008 at 02:18:27PM +0100, Manlio Perillo wrote: > > > Federico Di Gregorio ha scritto: > > > Il giorno gio, 03/01/2008 alle 21.26 -0800, Webb Sprague ha scritto: > > >> Is there a way for psycopg to return the PID of the process it is > > >> connected to, primarily for logging (and killing)? I am still trying > > >> to figure out how to stop a run of my program in mid-stream (besides a > > >> sleep() or waiting on a signal...), but that will get me started. > > > > > > No way, right now (unless you can do that using a query; I don't know.) > > select pg_cancel_backend(); This seems like it should work from inside a psql session but it doesn't: webbs-# ; pg_backend_pid ---------------- 14424 (1 row) webbs=# select pg_cancel_backend(14424); ERROR: canceling statement due to user request webbs=#