From: | Feike Steenbergen <feikesteenbergen(at)gmail(dot)com> |
---|---|
To: | rajan <vgmonnet(at)gmail(dot)com> |
Cc: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: SuperUser check in pg_stat_statements |
Date: | 2015-10-20 09:24:47 |
Message-ID: | CAK_s-G0_vBtR=Safrja10d1oWo-cSsQiBRoVJYQOQUoJNQCHYg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
You can create a Security Definer Funtion which can then be executed by
then non-superuser monitoring role:
(Assuming you have a role monitoring and pg_stat_statements is installed in
schema public)
-- connected as a superuser
CREATE FUNCTION pg_stat_statements()
RETURNS SETOF pg_stat_statements
LANGUAGE SQL
SET search_path='public'
SECURITY DEFINER
AS
$BODY$
SELECT *
FROM pg_stat_statements;
$BODY$;
REVOKE ALL ON FUNCTION pg_stat_statements() FROM public;
GRANT EXECUTE ON FUNCTION pg_stat_statements() TO monitoring;
-- connected as monitoring
SELECT * FROM pg_stat_statements();
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2015-10-20 10:23:18 | Re: Parallel Aggregate |
Previous Message | Syed, Rahila | 2015-10-20 08:58:11 | Re: [PROPOSAL] VACUUM Progress Checker. |