If you are using PostgreSQL and want to grant Superuser privileges to a regular user, you will find this blog post useful.
How to upgrade regular user to superuser in PostgreSQL
Scenario
There is a regular user arul
in your PostgreSQL database and want to give additional privileges and upgrade that user to Superuser.
Granting Superuser privilege is a straightforward process.
Check the user's current privileges
First, check the user's current privileges with \du
.
You should get something like this.
postgres=# \du
List of roles
Role name | Attributes | Member of
------------+------------------------------------------------------------+-----------
arul | | {}
Under List of roles / Attributes
you will not see anything, meaning arul
is a regular user.
Alter user's privileges
Next, run the alter user
command to upgrade the privileges of user arul
.
postgres=# alter user arul with superuser;
ALTER ROLE
A successful result will show the output ALTER ROLE
.
Verify that user is now Superuser
Verify that the user arul
is now a superuser by checking the privileges.
postgres=# \du
List of roles
Role name | Attributes | Member of
------------+------------------------------------------------------------+-----------
arul | Superuser | {}
Conclusion
Hopefully, this worked for you. If you are unable to promote a user to Superuser, let me know in the comments or by email. Thanks for reading.
Related Posts
If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.