Re: where table privileges are stored

From: "Markova, Nina" <Nina(dot)Markova(at)NRCan-RNCan(dot)gc(dot)ca>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>, "Markova, Nina" <Nina(dot)Markova(at)NRCan-RNCan(dot)gc(dot)ca>
Subject: Re: where table privileges are stored
Date: 2015-05-07 15:11:46
Message-ID: EAF139F744279142ABF70FFB636112A72BE4A91D@S-BSC-MBX4.nrn.nrcan.gc.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Perfect, thanks.

Nina

-----Original Message-----
From: Stephen Frost [mailto:sfrost(at)snowman(dot)net]
Sent: May-07-15 11:07
To: Markova, Nina
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] where table privileges are stored

Nina,

* Markova, Nina (Nina(dot)Markova(at)NRCan-RNCan(dot)gc(dot)ca) wrote:
> I need to check in a GUI if a user has certain privileges on the table he is trying to modify - insert/update/delete.

You probably want to use the "has_table_privilege" family of functions.

Look here: http://www.postgresql.org/docs/9.4/static/functions-info.html

> Something I could query system catalogs about:
> Select ... from ... where table_name = 'MYTABLE';
>
> Does Postgres store user privileges on tables in format similar to the one below, I mean the info below to be stored as a text field somewhere?
> grant delete on MYTABLE to myuser
> grant insert on MYTABLE to myuser

Privileges are stored in the catalog tables but not is a terribly useful format for querying, which is why the helper functions exist. If you want to look at it though, look at pg_class.relacl.

Thanks!

Stephen

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Matheus de Oliveira 2015-05-07 15:53:21 Re: where table privileges are stored
Previous Message Stephen Frost 2015-05-07 15:07:26 Re: where table privileges are stored