PostgreSQL user management
In my previous post I gave a brief introduction to PostgreSQL. In this post I’m going to dig deeper into user management and permissions.
Roles
PostgreSQL uses roles for authentication. There are two different kind of roles: groups and users. Users and groups can belong to groups; The only difference is that users can be used to log-in to a database. If a user is created with the INHERIT
property set, it will inherit permissions from the groups it belongs to.
To see all roles that currently exist on an installation of PostgreSQL, \du
can be used:
1
2
3
4
5
\du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}