Sometimes, you need to temporarily revoke a user's connection rights without actually deleting the user or changing the user's password. This recipe presents the ways of doing this.
Temporarily preventing a user from connecting
Getting ready
To modify other users, you must either be a superuser or have the CREATEROLE privilege (in the latter case, only non-superuser roles can be altered).
How to do it...
To temporarily prevent the user from logging in, run this command:
pguser=# alter user bob nologin;
ALTER ROLE
To let the user connect again, run the following...