Thread: pg_stat_activity

pg_stat_activity

From
Mat Proud
Date:
What permissions do I need to grant to a db-user so they can see
the current query column in

SELECT * FROM pg_stat_activity;

Newly created users can't see it by default - for security I guess?

Thanks!


Re: pg_stat_activity

From
Tom Lane
Date:
Mat Proud <matproud@bigfoot.com> writes:
> What permissions do I need to grant to a db-user so they can see
> the current query column in
> SELECT * FROM pg_stat_activity;

Non-superusers can only see their own queries in pg_stat_activity
(that is, the query of any backend running under the same PG user id).
This is not configurable.

I think that the original implementation only allowed superusers to
see query texts at all, and the exception for other backends of your own
userid was added later.  So if it doesn't seem to work as stated above,
maybe you need a newer Postgres release.

            regards, tom lane