pgsql: Have pg_terminate/cancel_backend not ERROR on non-existent proce - Mailing list pgsql-committers

From Alvaro Herrera
Subject pgsql: Have pg_terminate/cancel_backend not ERROR on non-existent proce
Date
Msg-id E1THJd4-0004Sr-3T@gemulon.postgresql.org
Whole thread Raw
List 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
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/01546402d4cbf88a66e680be5a9c6f018518050a

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


pgsql-committers by date:

Previous
From: Alvaro Herrera
Date:
Subject: pgsql: Have pg_terminate/cancel_backend not ERROR on non-existent proce
Next
From: Tom Lane
Date:
Subject: pgsql: Fix btmarkpos/btrestrpos to handle array keys.