pg_terminate_backend for same-role

Daniel Farina <daniel@heroku.com>

From: Daniel Farina <daniel@heroku.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2012-03-15T23:14:03Z
Lists: pgsql-hackers
Parallel to pg_cancel_backend, it'd be nice to allow the user to just
outright kill a backend that they own (politely, with a SIGTERM),
aborting any transactions in progress, including the idle transaction,
and closing the socket.

I imagine the problem is a race condition whereby a pid might be
reused by another process owned by another user (doesn't that also
affect pg_cancel_backend?).  Shall we just do everything using the
MyCancelKey (which I think could just be called "SessionKey",
"SessionSecret", or even just "Session") as to ensure we have no case
of mistaken identity? Or does that end up being problematic?

-- 
fdr