Thread: grant select on pg_stat_activity

grant select on pg_stat_activity

From
avi Singh
Date:
Guys
        Whats the best way to grant select on pg_stat_activity so that non super user can access this view. 

Thanks
Avi

Re: [GENERAL] grant select on pg_stat_activity

From
Adrian Klaver
Date:
On 03/18/2016 01:09 PM, avi Singh wrote:
> Guys
>          Whats the best way to grant select on pg_stat_activity so that
> non super user can access this view.

They should be able to, see below. If that is not your case, then more
information is needed.

guest@test=> select current_user;
  current_user


--------------


  guest
(1 row)

guest@test=> \du guest
            List of roles
  Role name | Attributes | Member of
-----------+------------+-----------
  guest     |            | {}


guest@test=> select * from pg_stat_activity;
-[ RECORD 1 ]----+--------------------------------
datid            | 16385
datname          | test
pid              | 2622
usesysid         | 1289138
usename          | guest
application_name | psql
client_addr      |
client_hostname  |
client_port      | -1
backend_start    | 2016-03-18 14:41:43.906754-07
xact_start       | 2016-03-18 14:44:22.550742-07
query_start      | 2016-03-18 14:44:22.550742-07
state_change     | 2016-03-18 14:44:22.550746-07
waiting          | f
state            | active
backend_xid      |
backend_xmin     | 58635
query            | select * from pg_stat_activity;

>
> Thanks
> Avi


--
Adrian Klaver
adrian.klaver@aklaver.com