pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Markova, Nina <Nina.Markova@NRCan-RNCan.gc.ca>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: where table privileges are stored
Date: Thu, 7 May 2015 11:07:26 -0400
Message-ID: <20150507150725.GB30322@tamriel.snowman.net> (raw)
In-Reply-To: <EAF139F744279142ABF70FFB636112A72BE4A8CA@S-BSC-MBX4.nrn.nrcan.gc.ca>
References: <EAF139F744279142ABF70FFB636112A72BE4A8CA@S-BSC-MBX4.nrn.nrcan.gc.ca>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

Nina,

* Markova, Nina (Nina.Markova@NRCan-RNCan.gc.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

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (4+ messages)  latest in thread

Message-ID: <20150507150725.GB30322@tamriel.snowman.net>
Permalink:  ../20150507150725.GB30322@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20150507150725.GB30322@tamriel.snowman.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: sfrost@snowman.net, Nina.Markova@NRCan-RNCan.gc.ca
  Subject: Re: where table privileges are stored
  In-Reply-To: <20150507150725.GB30322@tamriel.snowman.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox