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

From: "Marianne B(dot) Wiese" <mbwiese(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "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-07-01 09:26:00
Message-ID: CAGqADefmOY_5eq-9sQtyrdQO3ONeryxGEp-Duqy6xNTGKDQ2WA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thanks.
I had forgotten the Execute / Format way and I thought a parameter is an
identifier.

Generally the docs are concise and easy to understand.

Maybe the doc for SET ROLE doc could say something like 'See <link example>
for execution inside a function'

Marianne BW

On Tue, Jun 30, 2020 at 7:50 PM David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Tuesday, June 30, 2020, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
>> > 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.
>>
>> While this is documented (last para of "42.11.1. Variable Substitution"),
>> it's not exactly prominent. Should we move that to somewhere more
>> visible? If so where?
>>
>
> I think the docs are acceptable as-is - especially given the numerous
> cross-references to that section. If anything i’d maybe call out that most
> non-result returning commands are actually not parameterized in “42.2.5
> Executing a Command with No Result” just before the link to 42.11.1
>
> David J.
>
>

--
Marianne B. Wiese
Reventlowsgade 30
1651 København V

+45 51 92 69 18

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2020-07-01 10:01:14 BUG #16522: No anti-violent cracking mechanism
Previous Message Reiner Peterke 2020-07-01 07:25:57 Re: BUG #16516: when testing jit get terminate called after throwing an instance of 'std::bad_function_call'