Skip to content

Commit 953cf49

Browse files
doc: Note exceptions for SET ROLE's effect on privilege checks.
The documentation for SET ROLE states that superusers who switch to a non-superuser role lose their superuser privileges. While this is true for most commands, there are exceptions such as SET ROLE and SET SESSION AUTHORIZATION, which continue to use the current session user and the authenticated user, respectively. Furthermore, the description of this command already describes its effect, so it is arguably unnecessary to include this special case. This commit removes the note about the superuser case and adds a sentence about the aforementioned exceptions to the description. Co-authored-by: Yurii Rashkovskii Reviewed-by: Shubham Khanna, Robert Haas, Michael Paquier Discussion: https://postgr.es/m/CA%2BRLCQysHtME0znk2KUMJN343ksboSRQSU-hCnOjesX6VK300Q%40mail.gmail.com
1 parent e0df808 commit 953cf49

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

doc/src/sgml/ref/set_role.sgml

+4-6
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ RESET ROLE
3737
written as either an identifier or a string literal.
3838
After <command>SET ROLE</command>, permissions checking for SQL commands
3939
is carried out as though the named role were the one that had logged
40-
in originally.
40+
in originally. Note that <command>SET ROLE</command> and
41+
<command>SET SESSION AUTHORIZATION</command> are exceptions; permissions
42+
checks for those continue to use the current session user and the initial
43+
session user (the <firstterm>authenticated user</firstterm>), respectively.
4144
</para>
4245

4346
<para>
@@ -88,11 +91,6 @@ RESET ROLE
8891
exercised either with or without <literal>SET ROLE</literal>.
8992
</para>
9093

91-
<para>
92-
Note that when a superuser chooses to <command>SET ROLE</command> to a
93-
non-superuser role, they lose their superuser privileges.
94-
</para>
95-
9694
<para>
9795
<command>SET ROLE</command> has effects comparable to
9896
<link linkend="sql-set-session-authorization"><command>SET SESSION AUTHORIZATION</command></link>, but the privilege

0 commit comments

Comments
 (0)