Re: relacl parsing method? - Mailing list pgsql-general

From Josip Rodin
Subject Re: relacl parsing method?
Date
Msg-id 20100216114846.GA3382@orion.carnet.hr
Whole thread Raw
In response to relacl parsing method?  (Josip Rodin <joy@entuzijast.net>)
List pgsql-general
On Tue, Feb 16, 2010 at 12:22:29PM +0100, joy wrote:
> 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)

Hmm, sorry, it looks like the string after the slash (/) is grantor, rather
than database name. If I omit it, then it warns about defaulting grantor to
user ID 10. Is there any way to check for any grantor?

--
     2. That which causes joy or happiness.

pgsql-general by date:

Previous
From: Josip Rodin
Date:
Subject: relacl parsing method?
Next
From: Tom Lane
Date:
Subject: Re: relacl parsing method?