Given a connection to the PostgreSQL database for user 'Alice', is there a statement that could be executed to switch to user 'Bob'?
Motivation: Looking to avoid having separate pools for each user (i.e. re-use a connection that was previously used by another user).
CodePudding user response:
In PgAdmin open part Login/Group roles. Right click and in opened window enter new user, set permission and defined password. After refresh you will see e.g. Alice in Login/Group roles. After that open database with logged user. Click on something like mondial/postgres@PostgresSQL (db/user@server) and choose new connection. Chose which db wish to use and user wich will be connected on db.
After that you will have mondial/Alice@PostgresSQL
CodePudding user response:
You could do set role bob;
, but for that to work alice must have been granted bob. Note that a non-cooperating user could just set the role back to alice again if they wanted to.