postgresql - view schema privileges

mwrichardson picture mwrichardson · Mar 28, 2014 · Viewed 56.4k times · Source

Is there a query I can run to show currently assigned privileges on a particular schema?

i.e. privileges that were assigned like so:

GRANT USAGE ON SCHEMA dbo TO MyUser

I have tried

SELECT *
FROM information_schema.usage_privileges;

but this only returns grants to the built-in PUBLIC role. Instead, I want to see which users have been granted privileges on the various schema.

Note: I'm actually using Amazon Redshift rather than pure PostgreSQL, although I will accept a pure PostgreSQL answer if this is not possible in Amazon Redshift. (Though I suspect it is)

Answer

senz picture senz · Sep 8, 2015

in console util psql:

\dn+

will show you

     Name      |  Owner   |   Access privileges   |      Description