| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | Milen Dzhumerov <gamehack(at)gmail(dot)com> | 
| Cc: | pgsql-admin(at)postgresql(dot)org | 
| Subject: | Re: Permissions | 
| Date: | 2006-04-03 21:41:17 | 
| Message-ID: | 17016.1144100477@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-admin | 
Milen Dzhumerov <gamehack(at)gmail(dot)com> writes:
> I've been trying to figure a few things lately but I could not so I'm 
> asking on the list. I need to programmatically (through JDBC):
> 1. Figure out if the currently logged in user can create a schema
> 2. Figure out if a role has USAGE privileges on a schema
> 3. Figure out if a role has CREATE privileges on a schema
> 4. Figure out if a user can create a table in a schema
> I've been reading the online docs but I could nowhere see any examples 
> of finding out that information through the information_schema schema. I 
> was advised not to poke around with the pg_* schemas since they can 
> change frequently.
Check out the has_foo_privilege family of functions:
http://www.postgresql.org/docs/8.1/static/functions-info.html
> I can retrieve all the necessary permissions for tables from the 
> information_schema.table_privileges table with no problems but I'm 
> puzzled about database & schema privileges.
I think that those privileges are PG extensions to the standard, which
is why the standard information_schema views don't know about them ...
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kevin Grittner | 2006-04-03 22:57:53 | Re: pg_stat_activity showing non-existent processes | 
| Previous Message | Milen Dzhumerov | 2006-04-03 21:28:31 | Permissions |