pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Permissions
3+ messages / 2 participants
[nested] [flat]

* Permissions
@ 2006-04-03 21:28  Milen Dzhumerov <gamehack@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Milen Dzhumerov @ 2006-04-03 21:28 UTC (permalink / raw)
  To: pgsql-admin

Hello all,

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. What I need to do is basically ensure that a user can 
create a schema, then create some tables in that schema and ensure that 
other users can access these later. Is is possible that a user can be 
given for example SELECT privileges to a table in a schema but he/she 
would not be able to access the table because they don't have USAGE 
privileges on the schema which the table belongs to? I have found out 
that 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.

Kind regards,
gamehack



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Permissions
@ 2006-04-03 21:41  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Milen Dzhumerov <gamehack@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2006-04-03 21:41 UTC (permalink / raw)
  To: Milen Dzhumerov <gamehack@gmail.com>; +Cc: pgsql-admin

Milen Dzhumerov <gamehack@gmail.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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Permissions
@ 2006-04-04 09:24  Milen Dzhumerov <gamehack@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Milen Dzhumerov @ 2006-04-04 09:24 UTC (permalink / raw)
  To: pgsql-admin

Tom Lane wrote:
> Milen Dzhumerov <gamehack@gmail.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
>
>   
Thanks a lot. That's all I needed.

Kind regards,
gamehack



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2006-04-04 09:24 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-04-03 21:28 Permissions Milen Dzhumerov <gamehack@gmail.com>
2006-04-03 21:41 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-04-04 09:24   ` Milen Dzhumerov <gamehack@gmail.com>

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