Have pg_terminate/cancel_backend not ERROR on non-existent processes
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

ashwinstar/gpdb,pavanvd/postgres-xl,techdragon/Postgres-XL,oberstet/postgres-xl,yazun/postgres-xl,adam8157/gpdb,adam8157/gpdb,xinzweb/gpdb,ovr/postgres-xl,greenplum-db/gpdb,greenplum-db/gpdb,xinzweb/gpdb,lisakowen/gpdb,ashwinstar/gpdb,xinzweb/gpdb,techdragon/Postgres-XL,greenplum-db/gpdb,techdragon/Postgres-XL,Postgres-XL/Postgres-XL,lisakowen/gpdb,xinzweb/gpdb,50wu/gpdb,techdragon/Postgres-XL,greenplum-db/gpdb,adam8157/gpdb,50wu/gpdb,adam8157/gpdb,oberstet/postgres-xl,ovr/postgres-xl,pavanvd/postgres-xl,Postgres-XL/Postgres-XL,ashwinstar/gpdb,jmcatamney/gpdb,oberstet/postgres-xl,zeroae/postgres-xl,xinzweb/gpdb,Postgres-XL/Postgres-XL,ovr/postgres-xl,adam8157/gpdb,jmcatamney/gpdb,jmcatamney/gpdb,50wu/gpdb,ashwinstar/gpdb,adam8157/gpdb,ovr/postgres-xl,50wu/gpdb,lisakowen/gpdb,lisakowen/gpdb,yazun/postgres-xl,jmcatamney/gpdb,yazun/postgres-xl,50wu/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,jmcatamney/gpdb,50wu/gpdb,xinzweb/gpdb,greenplum-db/gpdb,lisakowen/gpdb,ashwinstar/gpdb,50wu/gpdb,oberstet/postgres-xl,adam8157/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,pavanvd/postgres-xl,zeroae/postgres-xl,lisakowen/gpdb,lisakowen/gpdb,xinzweb/gpdb,pavanvd/postgres-xl,50wu/gpdb,xinzweb/gpdb,yazun/postgres-xl,zeroae/postgres-xl,ashwinstar/gpdb,zeroae/postgres-xl,jmcatamney/gpdb,adam8157/gpdb,pavanvd/postgres-xl,Postgres-XL/Postgres-XL,yazun/postgres-xl,ashwinstar/gpdb,oberstet/postgres-xl,zeroae/postgres-xl,ovr/postgres-xl,techdragon/Postgres-XL,lisakowen/gpdb,greenplum-db/gpdb,Postgres-XL/Postgres-XL