1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Allow a user to kill his own queries using pg_cancel_backend()

Allows a user to use pg_cancel_queries() to cancel queries in
other backends if they are running under the same role.
pg_terminate_backend() still requires superuser permissoins.

Short patch, many authors working on the bikeshed: Magnus Hagander,
Josh Kupershmidt, Edward Muller, Greg Smith.
This commit is contained in:
Magnus Hagander
2012-01-15 15:34:40 +01:00
parent 652300f539
commit 0495aaad8b
2 changed files with 80 additions and 13 deletions

View File

@ -14262,8 +14262,8 @@ SELECT set_config('log_statement_stats', 'off', false);
<para>
The functions shown in <xref
linkend="functions-admin-signal-table"> send control signals to
other server processes. Use of these functions is restricted
to superusers.
other server processes. Use of these functions is usually restricted
to superusers, with noted exceptions.
</para>
<table id="functions-admin-signal-table">
@ -14280,7 +14280,10 @@ SELECT set_config('log_statement_stats', 'off', false);
<literal><function>pg_cancel_backend(<parameter>pid</parameter> <type>int</>)</function></literal>
</entry>
<entry><type>boolean</type></entry>
<entry>Cancel a backend's current query</entry>
<entry>Cancel a backend's current query. You can execute this against
another backend that has exactly the same role as the user calling the
function. In all other cases, you must be a superuser.
</entry>
</row>
<row>
<entry>
@ -14322,6 +14325,10 @@ SELECT set_config('log_statement_stats', 'off', false);
<command>postgres</command> processes on the server (using
<application>ps</> on Unix or the <application>Task
Manager</> on <productname>Windows</>).
For the less restrictive <function>pg_cancel_backend</>, the role of an
active backend can be found from
the <structfield>usename</structfield> column of the
<structname>pg_stat_activity</structname> view.
</para>
<para>