pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedClarification on SET SESSION AUTHORIZATION Syntax
6+ messages / 4 participants
[nested] [flat]
* Clarification on SET SESSION AUTHORIZATION Syntax
@ 2026-11-12 06:51 PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 6+ messages in thread
From: PG Doc comments form @ 2026-11-12 06:51 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org; +Cc: vishnupalani19@gmail.com
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;
```
Since `SESSION` and `LOCAL` are optional alternatives in the syntax, does
the first `SESSION` keyword allow the query to contain two consecutive
`SESSION` keywords?
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.
Thanks.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Clarification on SET SESSION AUTHORIZATION Syntax
@ 2026-11-13 03:01 Matemática A3K <matematica.a3k@gmail.com>
parent: PG Doc comments form <noreply@postgresql.org>
0 siblings, 2 replies; 6+ messages in thread
From: Matemática A3K @ 2026-11-13 03:01 UTC (permalink / raw)
To: vishnupalani19@gmail.com; pgsql-docs@lists.postgresql.org
On Thu, Nov 12, 2026 at 2:23 PM PG Doc comments form
<noreply@postgresql.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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Clarification on SET SESSION AUTHORIZATION Syntax
@ 2026-11-13 03:17 David G. Johnston <david.g.johnston@gmail.com>
parent: Matemática A3K <matematica.a3k@gmail.com>
1 sibling, 0 replies; 6+ messages in thread
From: David G. Johnston @ 2026-11-13 03:17 UTC (permalink / raw)
To: Matemática A3K <matematica.a3k@gmail.com>; +Cc: vishnupalani19@gmail.com <vishnupalani19@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
On Thursday, November 12, 2026, Matemática A3K <matematica.a3k@gmail.com>
wrote:
>
> > SET [ SESSION | LOCAL ] SESSION AUTHORIZATION user_name;
>
> 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
The square brackets are defined to mean optional in this scheme. It would
be { SESSION | LOCAL } if the choice were mandatory.
David J.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Clarification on SET SESSION AUTHORIZATION Syntax
@ 2026-11-13 03:32 David G. Johnston <david.g.johnston@gmail.com>
parent: Matemática A3K <matematica.a3k@gmail.com>
1 sibling, 1 reply; 6+ messages in thread
From: David G. Johnston @ 2026-11-13 03:32 UTC (permalink / raw)
To: Matemática A3K <matematica.a3k@gmail.com>; +Cc: vishnupalani19@gmail.com <vishnupalani19@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
On Thursday, November 12, 2026, Matemática A3K <matematica.a3k@gmail.com>
wrote:
>
> 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
>
Yes, the difference there seems like a simple oversight.
David J.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Clarification on SET SESSION AUTHORIZATION Syntax
@ 2026-11-14 02:59 Matemática A3K <matematica.a3k@gmail.com>
parent: David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Matemática A3K @ 2026-11-14 02:59 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: vishnupalani19@gmail.com <vishnupalani19@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
On Fri, Nov 13, 2026 at 12:32 AM David G. Johnston
<david.g.johnston@gmail.com> wrote:
>
> On Thursday, November 12, 2026, Matemática A3K <matematica.a3k@gmail.com> wrote:
>>
>> 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
>
>
> Yes, the difference there seems like a simple oversight.
Indeed! I tried changing the syntax to that and realized that I
couldn't rewrite the last paragraph of the description (woof! too
hard...). So, I only added the string literal referenced in the
description to the syntax.
Attaching the patch for completeness.
It makes sense to me to generate a bigger patch with all the patches
like this from time to time (let´s say, a month...), and commit it
with a subject like "doc: Monthly minor fixes". This way, small fixes
can get their way into the doc.
Do you think it would get approved?
>
> David J.
>
Attachments:
00001_doc_improve_set_authorization_syntax.patch (text/x-patch, 659B) download
diff --git a/doc/src/sgml/ref/set_session_auth.sgml b/doc/src/sgml/ref/set_session_auth.sgml
index 94adab2468d..e11065ce5e4 100644
--- a/doc/src/sgml/ref/set_session_auth.sgml
+++ b/doc/src/sgml/ref/set_session_auth.sgml
@@ -21,7 +21,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
-SET [ SESSION | LOCAL ] SESSION AUTHORIZATION <replaceable class="parameter">user_name</replaceable>
+SET [ SESSION | LOCAL ] SESSION AUTHORIZATION {<replaceable class="parameter">user_name</replaceable> | '<replaceable class="parameter">user_name</replaceable>'}
SET [ SESSION | LOCAL ] SESSION AUTHORIZATION DEFAULT
RESET SESSION AUTHORIZATION
</synopsis>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Clarification on SET SESSION AUTHORIZATION Syntax
@ 2026-11-16 04:27 Fujii Masao <masao.fujii@gmail.com>
parent: Matemática A3K <matematica.a3k@gmail.com>
0 siblings, 0 replies; 6+ messages in thread
From: Fujii Masao @ 2026-11-16 04:27 UTC (permalink / raw)
To: Matemática A3K <matematica.a3k@gmail.com>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; vishnupalani19@gmail.com <vishnupalani19@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
On Sat, Nov 14, 2026 at 11:59 AM Matemática A3K
<matematica.a3k@gmail.com> wrote:
> So, I only added the string literal referenced in the
> description to the syntax.
At least to me, adding the quoted form to the syntax summary seems
unnecessary. Because other commands, such as SET ROLE and SET,
also accept both identifiers and string literals, but their syntax summaries
in the docs don't explicitly show the quoted forms. Also the
SET SESSION AUTHORIZATION docs already states, "The user name can be
written as either an identifier or a string literal". Thought?
Regards,
--
Fujii Masao
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2026-11-16 04:27 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-12 06:51 Clarification on SET SESSION AUTHORIZATION Syntax PG Doc comments form <noreply@postgresql.org>
2026-11-13 03:01 ` Matemática A3K <matematica.a3k@gmail.com>
2026-11-13 03:17 ` David G. Johnston <david.g.johnston@gmail.com>
2026-11-13 03:32 ` David G. Johnston <david.g.johnston@gmail.com>
2026-11-14 02:59 ` Matemática A3K <matematica.a3k@gmail.com>
2026-11-16 04:27 ` Fujii Masao <masao.fujii@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox