PostgreSQL – How to RESET ROLE of a User
To revert to the original role of the logged in user, you can use the RESET ROLE
statement. This will revert to the role of the logged-in user.
Here is the syntax of using the RESET ROLE command:
RESET ROLE;
I’m currently logged in as user ‘postgres’ as shown in the below screenshot:
![](https://postgresql-tutorial.com/wp-content/uploads/2023/10/image-25.png)
Using the SET ROLE command, I’m going to assume admin_role as shown below:
![](https://postgresql-tutorial.com/wp-content/uploads/2023/10/image-26.png)
I have now switched to admin_role as shown below:
![](https://postgresql-tutorial.com/wp-content/uploads/2023/10/image-22.png)
Now, issuing the RESET ROLE command to revert to the original role of ‘postgres’.
![](https://postgresql-tutorial.com/wp-content/uploads/2023/10/image-24.png)
Current role can be verified as shown below:
![](https://postgresql-tutorial.com/wp-content/uploads/2023/10/image-23.png)