Hello!
May you know the way how to set role dynamically.
DO$$DECLARE act_dbowner varchar(100);BEGINSELECT u.usename into act_dbowner FROM pg_database dJOIN pg_user u ON (d.datdba = u.usesysid)WHERE d.datname = (SELECT current_database());raise notice 'DB owner: %', act_dbowner;set role to act_dbowner; -- THIS LINEEND$$;-------------
ERROR: role "act_dbowner" does not existCONTEXT: SQL statement "set role to act_dbowner"PL/pgSQL function inline_code_block line 10 at SQL statement
I try to use $act_dbowner, but it have no effect.
Thank you for your help!
Best wishes
dd