From: | Josip Rodin <joy(at)entuzijast(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | relacl parsing method? |
Date: | 2010-02-16 11:22:29 |
Message-ID: | 20100216112229.GA27842@orion.carnet.hr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I want to find out whether a user has a select privilege on a particular
database. This is what I see when it does:
# select relacl from pg_class where relname = 'mydbtable';
relacl
--------------------------------------------------------------------------
{mydbname=arwdxt/mydbname,mydbuser=r/mydbname}
(1 row)
Is this the best way to parse that easily from within PostgreSQL:
# select 1 from pg_class where relname = 'mydbtable' and relacl ~ 'mydbuser=r/mydbname';
?column?
----------
1
(1 row)
# select 1 from pg_class where relname = 'mydbtable' and relacl ~ 'mydbuser=w/mydbname';
?column?
----------
(0 rows)
Where is this documented? I tried searching for 'relacl' and 'aclitem' in
the docs, but didn't come up with much.
I did find a Perl module at http://search.cpan.org/~dwheeler/Pg-Priv-0.10/
that seems to extract relacl and parse it on its own, which sounds like a
kludge.
(Please Cc: replies, I'm not subscribed. TIA.)
--
2. That which causes joy or happiness.
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2010-02-16 11:35:14 | Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion |
Previous Message | Alban Hertroys | 2010-02-16 10:21:37 | Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion |