On Thu, Nov 12, 2026 at 2:23 PM PG Doc comments form
<[email protected]> 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


Reply via email to