| From: | Matemática A3K <matematica(dot)a3k(at)gmail(dot)com> |
|---|---|
| To: | vishnupalani19(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Clarification on SET SESSION AUTHORIZATION Syntax |
| Date: | 2026-11-13 03:01:30 |
| Message-ID: | CA+FDnhJBosE4QXq2=983vOJF3doJLp=uSJxgNmYK3UAxyompgw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-docs |
On Thu, Nov 12, 2026 at 2:23 PM PG Doc comments form
<noreply(at)postgresql(dot)org> wrote:
>
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/18/sql-set-session-authorization.html
> Description:
>
> Hi Team,
>
> In the `SET SESSION AUTHORIZATION` statement, the syntax is defined as:
>
> ```sql
> SET [ SESSION | LOCAL ] SESSION AUTHORIZATION user_name;
> ```
>
> I would like to clarify whether the following query is valid:
>
> ```sql
> SET SESSION SESSION AUTHORIZATION user_name;
> ```
~/code/pw main
❯ sudo -u postgres psql
[sudo] password for bot:
psql (18.6)
Type "help" for help.
postgres=# SET SESSION AUTHORIZATION 'paul';
ERROR: role "paul" does not exist
postgres=# SET SESSION SESSION AUTHORIZATION 'paul';
ERROR: role "paul" does not exist
postgres=# SET SESSION SESSION AUTHORIZATION 'postgres';
SET
postgres=# SET SESSION AUTHORIZATION 'postgres';
SET
postgres=# SET LOCAL SESSION AUTHORIZATION 'postgres';
WARNING: SET LOCAL can only be used in transaction blocks
SET
> Since `SESSION` and `LOCAL` are optional alternatives in the syntax,
I first read it as "one or the other", but it is "one or the other or
none", as you may see from my console log
> does
> the first `SESSION` keyword allow the query to contain two consecutive
> `SESSION` keywords?
If the question is "Is SET SESSION SESSION AUTHORIZATION 'user_name';
a valid statement?", then, yes. Otherwise, it is not clear to me.
> If this syntax is not valid, should we update the grammar to the following?
>
> ```sql
> SET [ LOCAL ] SESSION AUTHORIZATION user_name;
> ```
>
> Please clarify the expected syntax so that we can update the grammar
> accordingly.
The syntax is valid, no need to update that. The page makes more sense
after reading the SET one
(https://www.postgresql.org/docs/18/sql-set.html) linked,
After re-reading both, I wonder if a more appropriate syntax description is:
SET [ SESSION | LOCAL ] SESSION AUTHORIZATION { user_name |
'user_name' | DEFAULT }
RESET SESSION AUTHORIZATION
> Thanks.
Np
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David G. Johnston | 2026-11-13 03:17:54 | Clarification on SET SESSION AUTHORIZATION Syntax |
| Previous Message | Karen Jex | 2026-11-12 16:37:25 | Re: Good beginner doc-hacking task: clear-text vs. cleartext vs. clear text vs. plaintext etc.. |