diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c new file mode 100644 index f3c7860..d6e2623 *** a/src/backend/utils/adt/misc.c --- b/src/backend/utils/adt/misc.c *************** current_query(PG_FUNCTION_ARGS) *** 88,94 **** static int pg_signal_backend(int pid, int sig) { ! PGPROC *proc; if (!superuser()) { --- 88,105 ---- static int pg_signal_backend(int pid, int sig) { ! PGPROC *proc = BackendPidGetProc(pid); ! ! if (proc == NULL) ! { ! /* ! * This is just a warning so a loop-through-resultset will not abort ! * if one backend terminated on its own during the run ! */ ! ereport(WARNING, ! (errmsg("PID %d is not a PostgreSQL server process", pid))); ! return SIGNAL_BACKEND_ERROR; ! } if (!superuser()) { *************** pg_signal_backend(int pid, int sig) *** 103,124 **** * of this mechanism involve some request for ending the process * anyway, that it might end on its own first is not a problem. */ ! proc = BackendPidGetProc(pid); ! ! if (proc == NULL || proc->roleId != GetUserId()) return SIGNAL_BACKEND_NOPERMISSION; } - if (!IsBackendPid(pid)) - { - /* - * This is just a warning so a loop-through-resultset will not abort - * if one backend terminated on it's own during the run - */ - ereport(WARNING, - (errmsg("PID %d is not a PostgreSQL server process", pid))); - return SIGNAL_BACKEND_ERROR; - } /* * Can the process we just validated above end, followed by the pid being --- 114,123 ---- * of this mechanism involve some request for ending the process * anyway, that it might end on its own first is not a problem. */ ! if (proc->roleId != GetUserId()) return SIGNAL_BACKEND_NOPERMISSION; } /* * Can the process we just validated above end, followed by the pid being