On Wed, Jan 12, 2005 at 12:00:22PM -0600, Tony Caduto wrote:

> Does anyone know if such functions have been added to version 8?

See the 8.0 Release Notes in the development documentation:

  * Add function to send cancel request to other backends (Magnus)

See also the "System Administration Functions" section in the
"Functions and Operators" chapter.

Here's an example:

Session 1:
CREATE FUNCTION sleep(integer) RETURNS void AS $$
sleep $_[0];
$$ LANGUAGE plperlu;
SELECT sleep(60);

Session 2:
SELECT procpid, current_query FROM pg_stat_activity;
 procpid |   current_query   
---------+-------------------
...
   95609 | SELECT sleep(60);
...
SELECT pg_cancel_backend(95609);

Session 1:
ERROR:  canceling query due to user request

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to