I have an existing postgres 11
database called host_db
and we have an existing application called host_app
that has been using this database for a long time. This service uses superuser host_app_user
to connect to database and do all the transactions. Hence, all the database objects are owned by this database superuser.
Now, we want to create db_admin
superuser role too in our database whose credentials will be maintained by Vault
. But to not mix up database ownership, I was thinking that whenever db_admin
logs in to the database, it assumes the role of host_app_user
. That way whatever changes the logged admin does will all be done as host_app_user
.
My question is: Is there a way I can automatically set the role of logged in user in postgres at the time of logging in?