Giving limited superuser powers to specific users
The superuser role has some privileges that can also be granted to non-superuser roles separately.
To give the bob
role the ability to create new databases, run this:
ALTER ROLE BOB WITH CREATEDB;
To give the bob
role the ability to create new users, run the following command:
ALTER ROLE BOB WITH CREATEROLE;
Note that the PostgreSQL documentation warns against doing the preceding action:
“Be careful with the CREATEROLE privilege. There is no concept of inheritance for the privileges of a CREATEROLE-role. That means that even if a role does not have a certain privilege but is allowed to create other roles, it can easily create another role with different privileges than its own (except for creating roles with superuser privileges). For example, if the role “user” has the CREATEROLE privilege but not the CREATEDB privilege, nonetheless, it can create a new role with the CREATEDB privilege...