Get the list of permissions on schema for current user

Started by dipti shahabout 16 years ago3 messagesgeneral
Jump to latest
#1dipti shah
shahdipti1980@gmail.com

Hi,

I ran below command to list out all privileges of objects if "mydb" schema.
Actually, I want to know what are the permissions "user1" has on mydb
schema. Could you please tell me how to do this?

mydb=# select pc.relname, pc.relacl from pg_class pc, pg_namespace pn where
pc.relnamespace=pn.oid and pn.nspname='mydb';
relname | relacl
----------------------------------+-----------------------------------------------
mylog |
{postgres=arwdDxt/postgres,=arwdDxt/postgres}
techtable | {postgres=arwdDxt/postgres,=ar/postgres}
techtable_log |
hrtable | {postgres=arwdDxt/postgres,=ar/postgres}
hrtable_log |
(5 rows)

mydb=> select current_user;
current_user
--------------
user1
(1 row)

mydb=>

Thanks, Dipti

#2dipti shah
shahdipti1980@gmail.com
In reply to: dipti shah (#1)

Hi,

I ran below command to list out all privileges of objects if "mydb" schema.
Actually, I want to know what are the permissions "user1" has on mydb
schema. Could you please tell me how to do this?

mydb=# select pc.relname, pc.relacl from pg_class pc, pg_namespace pn where
pc.relnamespace=pn.oid and pn.nspname='mydb';
relname | relacl
----------------------------------+-----------------------------------------------
mylog |
{postgres=arwdDxt/postgres,=arwdDxt/postgres}
techtable | {postgres=arwdDxt/postgres,=ar/postgres}
techtable_log |
hrtable | {postgres=arwdDxt/postgres,=ar/postgres}
hrtable_log |
(5 rows)

mydb=> select current_user;
current_user
--------------
user1
(1 row)

mydb=>

Thanks, Dipti

#3Jignesh Shah
jignesh.shah1980@gmail.com
In reply to: dipti shah (#2)
Re: Get the list of permissions on schema for current user

I don't think you can do it. You have to parse the string you got from
pg_namespace to get the current user's permissions.

On Thu, Apr 1, 2010 at 11:09 AM, dipti shah <shahdipti1980@gmail.com> wrote:

Show quoted text

Hi,

I ran below command to list out all privileges of objects if "mydb" schema.
Actually, I want to know what are the permissions "user1" has on mydb
schema. Could you please tell me how to do this?

mydb=# select pc.relname, pc.relacl from pg_class pc, pg_namespace pn where
pc.relnamespace=pn.oid and pn.nspname='mydb';
relname | relacl

----------------------------------+-----------------------------------------------
mylog |
{postgres=arwdDxt/postgres,=arwdDxt/postgres}
techtable |
{postgres=arwdDxt/postgres,=ar/postgres}
techtable_log |
hrtable |
{postgres=arwdDxt/postgres,=ar/postgres}
hrtable_log |
(5 rows)

mydb=> select current_user;
current_user
--------------
user1
(1 row)

mydb=>

Thanks, Dipti