pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Milen Dzhumerov <gamehack@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Permissions
Date: Mon, 03 Apr 2006 17:41:17 -0400
Message-ID: <17016.1144100477@sss.pgh.pa.us> (raw)
In-Reply-To: <4431937F.808@gmail.com>
References: <4431937F.808@gmail.com>

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



view thread (3+ messages)  latest in thread

Message-ID: <17016.1144100477@sss.pgh.pa.us>
Permalink:  ../17016.1144100477@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17016.1144100477@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gamehack@gmail.com
  Subject: Re: Permissions
  In-Reply-To: <17016.1144100477@sss.pgh.pa.us>
  References: <4431937F.808@gmail.com> <17016.1144100477@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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