X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 7AEF311F66EA for ; Mon, 3 Apr 2006 18:41:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51259-09 for ; Mon, 3 Apr 2006 18:41:20 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 5086111F6CDE for ; Mon, 3 Apr 2006 18:41:18 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k33LfHr5017017; Mon, 3 Apr 2006 17:41:17 -0400 (EDT) To: Milen Dzhumerov cc: pgsql-admin@postgresql.org Subject: Re: Permissions In-reply-to: <4431937F.808@gmail.com> References: <4431937F.808@gmail.com> Comments: In-reply-to Milen Dzhumerov message dated "Mon, 03 Apr 2006 22:28:31 +0100" Date: Mon, 03 Apr 2006 17:41:17 -0400 Message-ID: <17016.1144100477@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200604/35 X-Sequence-Number: 21204 Milen Dzhumerov 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