Re: select a list of schema names

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Andrus Moor <nospameetasoftnospam(at)online(dot)ee>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: select a list of schema names
Date: 2005-03-27 08:04:35
Message-ID: 20050327080435.GA46395@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Mar 25, 2005 at 09:50:18PM +0200, Andrus Moor wrote:
>
> How to select a list of schema names which current user is authorized to
> access ?

See "System Catalogs" and "System Information Functions" (or
"Miscellaneous Functions") in the documentation. Here are links
to documentation for the latest release:

http://www.postgresql.org/docs/8.0/interactive/catalogs.html
http://www.postgresql.org/docs/8.0/interactive/functions-info.html

Something like this might be what you're looking for:

SELECT nspname
FROM pg_namespace
WHERE has_schema_privilege(nspname, 'USAGE')
ORDER BY nspname;

Note that USAGE privilege on a schema doesn't necessarily mean the
user has any privileges on the objects in that schema.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fuhr 2005-03-27 08:09:51 Re: Accessing other Databases
Previous Message Tom Lane 2005-03-27 07:57:10 Re: How to make update statement to work