Re: BUG #16519: SET SESSION ROLE in plpgsql requires string literal.

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "mbwiese(at)gmail(dot)com" <mbwiese(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16519: SET SESSION ROLE in plpgsql requires string literal.
Date: 2020-06-30 16:39:03
Message-ID: CAKFQuwZByEvyM9KUtRn0yjT81dGuVaFKpHzBjhVsEAd7WPgasA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tuesday, June 30, 2020, PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference: 16519
> Logged by: Marianne B. Wiese
> Email address: mbwiese(at)gmail(dot)com
> PostgreSQL version: 10.12
> Operating system: Ubuntu 18.04
> Description:
>
> However, the loop in below function gives me an error:
> [22023] ERROR: role "inuser" does not exist Where: SQL statement "SET
> SESSION ROLE TO InUser" PL/pgSQL function change_user(name) line 8 at SQL
> statement.
>
> SET SESSION ROLE TO InUser;
>
>
The SET command cannot be parameterized so using variables in the statement
is not supported and the attempt to do so is treated as writing an
identifier. You will need to use the format function and the execute
plpgsql command to create and execute the statement.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jehan-Guillaume de Rorthais 2020-06-30 16:57:16 Re: [BUG][PATCH] ecpg crash with bytea type and cursors
Previous Message Michael Meskes 2020-06-30 16:38:08 Re: [BUG][PATCH] ecpg crash with bytea type and cursors