Re: How to execute 'set session role' from plpgsql function? - Mailing list pgsql-general

From Tom Lane
Subject Re: How to execute 'set session role' from plpgsql function?
Date
Msg-id 20472.1219157030@sss.pgh.pa.us
Whole thread Raw
In response to Re: How to execute 'set session role' from plpgsql function?  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
List pgsql-general
"Albe Laurenz" <laurenz.albe@wien.gv.at> writes:
>    EXECUTE 'SET SESSION ROLE "' || lower(regexp_replace(wishedrole, '"', '', 'g')) || '"';

> The "lower" and "regexp_replace" are there to prevent SQL injection.

quote_ident() would be a far better solution.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: 8.3.3 win32 crashing
Next
From: Alvaro Herrera
Date:
Subject: Re: Re: can't get UPDATE ... RETURNING ... INTO ... to compile successfully