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

Поиск
Список
Период
Сортировка
От Dmitry Koterov
Тема Re: How to execute 'set session role' from plpgsql function?
Дата
Msg-id d7df81620808170903k1d841388w315cd86b1e941e00@mail.gmail.com
обсуждение исходный текст
Ответ на How to execute 'set session role' from plpgsql function?  (Oleg Vasylenko <pulp@mail.ru>)
Список pgsql-general
Just a suggestion:

EXECUTE 'SET SESSION ROLE wishedrole';

won't help?


2008/8/17 Oleg Vasylenko <pulp@mail.ru>
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

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

В списке pgsql-general по дате отправления:

Предыдущее
От: Mark
Дата:
Сообщение: Re: [Q] DNS(bind) ER model
Следующее
От: "Roderick A. Anderson"
Дата:
Сообщение: Re: [Q] DNS(bind) ER model