Hello everyone!
----
I need to change the session user in the script, depending on whether it is defined.
I'm trying to do it this way:
---
```
down
$body$
declare
_username;
begin
if 'reporter' in (select usename from pg_catalog.pg_user) then
raise notice 'user: reporter' ;
_user := '"srg"'::name;
else
raise notice 'user: postgres' ;
_user := 'postgres'::name;
end if;
SET SESSION AUTHORIZATION _user::name;
end;
$body$
;
```
---
Unfortunately, I don't know how to convert it so that SET SESSION AUTHORIZATION works properly.
I am asking for support.
--
Regards,
keypey