Re: SuperUser check in pg_stat_statements

From: Lukas Fittl <lukas(at)fittl(dot)com>
To: rajan <vgmonnet(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SuperUser check in pg_stat_statements
Date: 2015-10-19 22:18:24
Message-ID: CAP53Pkw-7oZBrhBBB7_U=ijQcuReSxzwW27j44yX7t9gKPC64Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 19, 2015 at 3:12 PM, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com> wrote:

> On 10/19/15 3:48 PM, rajan wrote:
>
>> Thanks Stephen and Shulgin for your response.
>>
>> Will go through the patch and will try to solve my problem using that.
>>
>> My scenario is that i need to have an user who cannot be a super user but
>> a
>> monitor user, who will be able to see all the queries executed by all
>> users.
>>
>
> You can set that up today by defining a view on top of pg_stat_statements
> (or maybe it needs a SECDEF SRF... been a while since I've done it).

You can solve this using a security definer method created by a superuser,
see

https://gist.github.com/lfittl/9ee78ac200e4e7ebe33d

for a full example.

--
Lukas Fittl

Skype: lfittl
Phone: +1 415 321 0630

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2015-10-19 23:55:27 Re: Why no CONSTANT for row variables in plpgsql?
Previous Message Jim Nasby 2015-10-19 22:16:22 Re: Why no CONSTANT for row variables in plpgsql?