Skip to content

Instantly share code, notes, and snippets.

@alanwsmith
Created December 15, 2020 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanwsmith/7d344c2b60e79bac39b122ccb186b508 to your computer and use it in GitHub Desktop.
Save alanwsmith/7d344c2b60e79bac39b122ccb186b508 to your computer and use it in GitHub Desktop.
Example of viewing permissions in postgres with `\du` vs `\l`
postgres-# \du
List of roles
Role name | Attributes | Member of
---------------------+------------------------------------------------------------+-----------
launchpad_dev_user | | {}
launchpad_prod_user | | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
toolkit_dev_user | | {}
toolkit_prod | | {}
toolkit_prod_user | | {}
postgres-# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-------------------+----------+----------+---------+-------+----------------------------------
launchpad_dev_db | postgres | UTF8 | C | C | =Tc/postgres +
| | | | | postgres=CTc/postgres +
| | | | | launchpad_dev_user=CTc/postgres
launchpad_prod_db | postgres | UTF8 | C | C | =Tc/postgres +
| | | | | postgres=CTc/postgres +
| | | | | launchpad_prod_user=CTc/postgres
postgres | postgres | UTF8 | C | C |
template0 | postgres | UTF8 | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
toolkit_dev_db | postgres | UTF8 | C | C | =Tc/postgres +
| | | | | postgres=CTc/postgres +
| | | | | toolkit_dev_user=CTc/postgres
toolkit_prod_db | postgres | UTF8 | C | C | =Tc/postgres +
| | | | | postgres=CTc/postgres +
| | | | | toolkit_prod_user=CTc/postgres
(7 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment