Search Postgresql Archives

How to execute 'set session role' from plpgsql function?

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

 



Hi,everybody!

I wish to have a function with code above, but compiller generate
syntactic error at the line "SET SESSION ROLE wishedrole;".

How to pass the wishedrole value to the structure?

CREATE OR REPLACE FUNCTION f_switch_role(INOUT text,INOUT boolean) AS
 $BODY$
 DECLARE
   wishedrole ALIAS FOR $1;
   resetrole ALIAS FOR $2;
 BEGIN
   if resetrole=true then
            RESET ROLE;
            RETURN;
   end if;

>>>>ERROR OCURS AT THE NEXT LINE <<<<<<
   SET SESSION ROLE wishedrole;
   RETURN;
 
 END;
 $BODY$
 LANGUAGE 'plpgsql' VOLATILE




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux