patternsqlCritical
List the database privileges using psql
Viewed 0 times
theprivilegesdatabasepsqlusinglist
Problem
I'm in the middle of a database server migration and I can't figure (after googling and searching here) how can I list the database privileges (or all the privileges across the server) on PostgreSQL using the
I'm on Ubuntu 11.04 and my PostgreSQL version is 8.2.x.
psql command line tool?I'm on Ubuntu 11.04 and my PostgreSQL version is 8.2.x.
Solution
postgres=> \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgresThe docs on Privileges give an explanation of how to interpret the output. For specific privileges on a table of the current database, use
\z myTable.Code Snippets
postgres=> \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgresContext
StackExchange Database Administrators Q#4286, answer score: 225
Revisions (0)
No revisions yet.