Skip site navigation (1) Skip section navigation (2)

pgsql: Have pg_terminate/cancel_backend not ERROR on non-existentproce

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Have pg_terminate/cancel_backend not ERROR on non-existentproce
Date: 2012-09-27 19:20:09
Message-ID: E1THJd3-0004Sp-Di@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Have pg_terminate/cancel_backend not ERROR on non-existent processes

This worked fine for superusers, but not for ordinary users trying to
cancel their own processes.  Tweak the order the checks are done in so
that we correctly return SIGNAL_BACKEND_ERROR (which current callers
know to ignore without erroring out) so that an ordinary user can loop
through a resultset without fearing that a process might exit in the
middle of said looping -- causing the remaining processes to go
unsignalled.

Incidentally, the last in-core caller of IsBackendPid() is now gone.
However, the function is exported and must remain in place, because
there are plenty of callers in external modules.

Author: Josh Kupershmidt

Reviewed by Noah Misch

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ae90ffada4cb27c9194797c43d864a86ce88d72c

Modified Files
--------------
src/backend/utils/adt/misc.c |   39 ++++++++++++++++-----------------------
1 files changed, 16 insertions(+), 23 deletions(-)

pgsql-committers by date

Next:From: Alvaro HerreraDate: 2012-09-27 19:20:10
Subject: pgsql: Have pg_terminate/cancel_backend not ERROR on non-existentproce
Previous:From: Tom LaneDate: 2012-09-27 03:12:45
Subject: pgsql: Run check_keywords.pl anytime gram.c is rebuilt.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group