2 doc/src/sgml/ref/alter_system.sgml
3 PostgreSQL documentation
6 <refentry id=
"sql-altersystem">
7 <indexterm zone=
"sql-altersystem">
8 <primary>ALTER SYSTEM
</primary>
12 <refentrytitle>ALTER SYSTEM
</refentrytitle>
13 <manvolnum>7</manvolnum>
14 <refmiscinfo>SQL - Language Statements
</refmiscinfo>
18 <refname>ALTER SYSTEM
</refname>
19 <refpurpose>change a server configuration parameter
</refpurpose>
24 ALTER SYSTEM SET
<replaceable class=
"parameter">configuration_parameter
</replaceable> { TO | = } {
<replaceable class=
"parameter">value
</replaceable> [, ...] | DEFAULT }
26 ALTER SYSTEM RESET
<replaceable class=
"parameter">configuration_parameter
</replaceable>
27 ALTER SYSTEM RESET ALL
32 <title>Description
</title>
35 <command>ALTER SYSTEM
</command> is used for changing server configuration
36 parameters across the entire database cluster. It can be more convenient
37 than the traditional method of manually editing
38 the
<filename>postgresql.conf
</filename> file.
39 <command>ALTER SYSTEM
</command> writes the given parameter setting to
40 the
<filename>postgresql.auto.conf
</filename> file, which is read in
41 addition to
<filename>postgresql.conf
</filename>.
42 Setting a parameter to
<literal>DEFAULT
</literal>, or using the
43 <command>RESET
</command> variant, removes that configuration entry from the
44 <filename>postgresql.auto.conf
</filename> file. Use
<literal>RESET
45 ALL
</literal> to remove all such configuration entries.
49 Values set with
<command>ALTER SYSTEM
</command> will be effective after
50 the next server configuration reload, or after the next server restart
51 in the case of parameters that can only be changed at server start.
52 A server configuration reload can be commanded by calling the SQL
53 function
<function>pg_reload_conf()
</function>, running
<literal>pg_ctl reload
</literal>,
54 or sending a
<systemitem>SIGHUP
</systemitem> signal to the main server process.
58 Only superusers and users granted
<literal>ALTER SYSTEM
</literal> privilege
59 on a parameter can change it using
<command>ALTER SYSTEM
</command>. Also, since
60 this command acts directly on the file system and cannot be rolled back,
61 it is not allowed inside a transaction block or function.
66 <title>Parameters
</title>
70 <term><replaceable class=
"parameter">configuration_parameter
</replaceable></term>
73 Name of a settable configuration parameter. Available parameters are
74 documented in
<xref linkend=
"runtime-config"/>.
80 <term><replaceable class=
"parameter">value
</replaceable></term>
83 New value of the parameter. Values can be specified as string
84 constants, identifiers, numbers, or comma-separated lists of
85 these, as appropriate for the particular parameter.
86 Values that are neither numbers nor valid identifiers must be quoted.
87 <literal>DEFAULT
</literal> can be written to specify removing the
88 parameter and its value from
<filename>postgresql.auto.conf
</filename>.
92 For some list-accepting parameters, quoted values will produce
93 double-quoted output to preserve whitespace and commas; for others,
94 double-quotes must be used inside single-quoted strings to get
106 This command can't be used to set
<xref linkend=
"guc-data-directory"/>,
107 <xref linkend=
"guc-allow-alter-system"/>,
108 nor parameters that are not allowed in
<filename>postgresql.conf
</filename>
109 (e.g.,
<link linkend=
"runtime-config-preset">preset options
</link>).
113 See
<xref linkend=
"config-setting"/> for other ways to set the parameters.
117 <literal>ALTER SYSTEM
</literal> can be disabled by setting
118 <xref linkend=
"guc-allow-alter-system"/> to
<literal>off
</literal>, but this
119 is not a security mechanism (as explained in detail in the documentation for
125 <title>Examples
</title>
128 Set the
<literal>wal_level
</literal>:
130 ALTER SYSTEM SET wal_level = replica;
135 Undo that, restoring whatever setting was effective
136 in
<filename>postgresql.conf
</filename>:
138 ALTER SYSTEM RESET wal_level;
139 </programlisting></para>
143 <title>Compatibility
</title>
146 The
<command>ALTER SYSTEM
</command> statement is a
147 <productname>PostgreSQL
</productname> extension.
152 <title>See Also
</title>
154 <simplelist type=
"inline">
155 <member><xref linkend=
"sql-set"/></member>
156 <member><xref linkend=
"sql-show"/></member>