pg_terminate_backend ( pid integer, timeout bigint DEFAULT 0 ) → booleanTerminates the session whose backend process has the specified process ID. This is also allowed if the calling role is a member of the role whose backend is being terminated or the calling role has privileges of
pg_signal_backend, however only superusers can terminate superuser backends. As an exception, roles with privileges of pg_signal_autovacuum_worker are permitted to terminate autovacuum worker processes, which are otherwise considered superuser backends.