"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