Re: pg_stat_activity - Mailing list pgsql-hackers

From ivan
Subject Re: pg_stat_activity
Date
Msg-id Pine.LNX.4.56.0307072116310.3075@rex.anfa.pl
Whole thread Raw
In response to pg_stat_activity  (ohp@pyrenet.fr)
Responses Re: pg_stat_activity  (Kevin Brown <kevin@sysexperts.com>)
List pgsql-hackers
You can create function with security definer as super user
sth like this
create or replace function func () returns setof pg_stat_activity as '
select * from pg_stat_activity ; ' language SQL SECURITY DEFINER;

and if you want to se only query of session user you need to replace
* to columns from view pg_stat_activity , and to column query
you need to use CASE , when username == SESSION_USER : cur_query,
else null;

On Mon, 7 Jul 2003 ohp@pyrenet.fr wrote:

> Hi every one,
>
> Is there a way for joe user (not superuser) to see current query on HIS
> database on pg_stat_activity.
>
> ISTM that only superuser can see current query for all.
>
> As fr security, it doesn't seem right that select * from pg_stat_activity
> shows all databases.
>
> What do you think?
>
> --
> Olivier PRENANT                    Tel: +33-5-61-50-97-00 (Work)
> 6, Chemin d'Harraud Turrou           +33-5-61-50-97-01 (Fax)
> 31190 AUTERIVE                       +33-6-07-63-80-64 (GSM)
> FRANCE                          Email: ohp@pyrenet.fr
> ------------------------------------------------------------------------------
> Make your life a dream, make your dream a reality. (St Exupery)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>


pgsql-hackers by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: How to submit Tsearch V2 ?
Next
From: Kevin Brown
Date:
Subject: Re: pg_stat_activity