Re: Terminate connections using non-superuser

From: Scott Mead <scottm(at)openscg(dot)com>
To: amandeep singh <singh_a(at)live(dot)in>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Terminate connections using non-superuser
Date: 2017-08-02 12:49:06
Message-ID: CAKq0gvKC7-P4Tv-Dtm+eJFm+6jEw11dsi30YNEpjabvOwmF5yw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Wed, Aug 2, 2017 at 8:36 AM, amandeep singh <singh_a(at)live(dot)in> wrote:

> Hi All
>
>
> I have a requirement where I need a non-superuser who can view
> (pg_stat_activity) and terminate (pg_terminate_backend) connections of
> other users. Is it possible to give such privileges to non-superuser?
>
>
>
Create a wrapper function, my_pg_stat_activity() or
my_pg_terminate_backend()

on creation, use 'security definer'

https://www.postgresql.org/docs/9.3/static/sql-createfunction.html#SQL-CREATEFUNCTION-SECURITY

> Postgres Version :PostgreSQL9.6
>
>
>
>
> Thanks and Regards:
> Amandeep Singh
>

--
--
Scott Mead
Sr. Architect
*OpenSCG <http://openscg.com>*
http://openscg.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Pankaj Arora 2017-08-02 18:12:55 PostgreSQL 9.3 Uninstall error - Windows 2012
Previous Message Naveen Kumar 2017-08-02 12:45:27 Re: Terminate connections using non-superuser