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:

Using the SET ROLE command, I’m going to assume admin_role as shown below:

I have now switched to admin_role as shown below:

Now, issuing the RESET ROLE command to revert to the original role of ‘postgres’.

Current role can be verified as shown below:

Similar Posts