PostgreSQL – How to Disable(Lock) a User
You can disable a user account in PostgreSQL database by revoking their login privileges. Disabling a user prevents them from connecting to the PostgreSQL database server.
Here’s the basic syntax to revoke login privileges from a user globally:
ALTER USER username NOLOGIN;
Where username
is the name of the user you want to lock/disable.
By running the above command, you will effectively disable the user’s ability to connect to the PostgreSQL database server.