From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "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-10-02 20:11:41 |
Message-ID: | CAKFQuwYYM40J9AP6VbSxMtT1oEUQ8mqETndFh=peH_Cyzm1ZyA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Tue, Jun 30, 2020 at 10:50 AM 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
>
>
Concretely, as attached.
I found the comment about the 9.0 behavior to be unnecessary at this point
and so removed it.
The wording in the PL/SQL conversion comments is a bit out-of-scope but
took a look at it too as it also redirects the user to the variable
discussion and I looked at all 4 cross-references.
David J.
Attachment | Content-Type | Size |
---|---|---|
v1-doc-plpgsql-variable-usage-cleanup.patch | application/octet-stream | 4.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | lights go out | 2020-10-03 00:14:01 | Unnecessary FOR UPDATE lock instead of possible FOR NO KEY UPDATE lock in an UPSERT statement |
Previous Message | PG Bug reporting form | 2020-10-02 09:10:05 | BUG #16651: could rename global.tmp to global.stat due to permission denied |