Skip to content

Praefect: Add a new parameter to set the current user identifier in DB connection

Hi!

We have a scenario that we don't run our applications with a full privileges. So we need the ability to use a user with less privileges (only to do DML) and use other user to run the migrations. Using another user to it we need the ability to define the current user identifier to create PostgreSQL objects correctly.

So I added a new connection parameter to set the role as described in PostgreSQL docs:

This command sets the current user identifier of the current SQL session to be role_name. The role name can be written as either an identifier or a string literal. After SET ROLE, permissions checking for SQL commands is carried out as though the named role were the one that had logged in originally.

https://www.postgresql.org/docs/12/sql-set-role.html

Merge request reports