check postgresql roles code example Example 1: postgresql list users postgres=# \du Example 2: get role postgres SELECT rolname FROM pg_roles;