The PostgreSQL superuser
A PostgreSQL superuser is a user that bypasses all permission checks, except the right to log in. Superuser is a dangerous privilege and should not be used carelessly. Many cloud databases do not allow this level of privilege to be granted at all. It is normal to place strict controls on users of this type. If you are using PostgreSQL in a cloud service, then please read the Setting up cloud security using predefined roles recipe instead.
In this recipe, you will learn how to grant a user the right to become a superuser.
How to do it…
Follow the next steps to add or remove superuser privileges for any user:
- A user becomes a superuser when they are created with the
SUPERUSER
attribute set:CREATE USER username SUPERUSER;
- A user can be deprived of their superuser status by removing the
SUPERUSER
attribute using this command:ALTER USER username NOSUPERUSER;
- A user can be restored to superuser...