You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This generalizes the existing ALTER ROLE ... SET and ALTER DATABASE
... SET functionality to allow creating settings that apply to all users
in all databases.
reviewed by Pavel Stehule
Copy file name to clipboardExpand all lines: doc/src/sgml/ref/alter_role.sgml
+20-7
Original file line number
Diff line number
Diff line change
@@ -39,9 +39,9 @@ ALTER ROLE <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replace
39
39
ALTER ROLE <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
40
40
41
41
ALTER ROLE <replaceable class="PARAMETER">name</replaceable> [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> { TO | = } { <replaceable>value</replaceable> | DEFAULT }
42
-
ALTER ROLE <replaceable class="PARAMETER">name</replaceable> [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> FROM CURRENT
43
-
ALTER ROLE <replaceable class="PARAMETER">name</replaceable> [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] RESET <replaceable>configuration_parameter</replaceable>
44
-
ALTER ROLE <replaceable class="PARAMETER">name</replaceable> [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] RESET ALL
42
+
ALTER ROLE { <replaceable class="PARAMETER">name</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] SET <replaceable>configuration_parameter</replaceable> FROM CURRENT
43
+
ALTER ROLE { <replaceable class="PARAMETER">name</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] RESET <replaceable>configuration_parameter</replaceable>
44
+
ALTER ROLE { <replaceable class="PARAMETER">name</replaceable> | ALL } [ IN DATABASE <replaceable class="PARAMETER">database_name</replaceable> ] RESET ALL
45
45
</synopsis>
46
46
</refsynopsisdiv>
47
47
@@ -83,8 +83,15 @@ ALTER ROLE <replaceable class="PARAMETER">name</replaceable> [ IN DATABASE <repl
83
83
<para>
84
84
The remaining variants change a role's session default for a configuration
85
85
variable, either for all databases or, when the <literal>IN
86
-
DATABASE</literal> clause is specified, only for sessions in
87
-
the named database. Whenever the role subsequently
86
+
DATABASE</literal> clause is specified, only for sessions in the named
87
+
database. If <literal>ALL</literal> is specified instead of a role name,
88
+
this changes the setting for all roles. Using <literal>ALL</literal>
89
+
with <literal>IN DATABASE</literal> is effectively the same as using the
90
+
command <literal>ALTER DATABASE ... SET ...</literal>.
91
+
</para>
92
+
93
+
<para>
94
+
Whenever the role subsequently
88
95
starts a new session, the specified value becomes the session
89
96
default, overriding whatever setting is present in
90
97
<filename>postgresql.conf</> or has been received from the <command>postgres</command>
@@ -93,12 +100,17 @@ ALTER ROLE <replaceable class="PARAMETER">name</replaceable> [ IN DATABASE <repl
93
100
<xref linkend="sql-set-session-authorization"> does not cause new
94
101
configuration values to be set.
95
102
Settings set for all databases are overridden by database-specific settings
96
-
attached to a role.
103
+
attached to a role. Settings for specific databases or specific roles override
104
+
settings for all roles.
105
+
</para>
106
+
107
+
<para>
97
108
Superusers can change anyone's session defaults. Roles having
98
109
<literal>CREATEROLE</> privilege can change defaults for non-superuser
99
110
roles. Ordinary roles can only set defaults for themselves.
100
111
Certain configuration variables cannot be set this way, or can only be
101
-
set if a superuser issues the command.
112
+
set if a superuser issues the command. Only superusers can change a setting
113
+
for all roles in all databases.
102
114
</para>
103
115
</refsect1>
104
116
@@ -307,6 +319,7 @@ ALTER ROLE fred IN DATABASE devel SET client_min_messages = DEBUG;
0 commit comments