Assign TEXT/NAME variable type to SET SESSION AUTHORIZATION

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux