1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ALTER SYSTEM</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="sql-altersubscription.html" title="ALTER SUBSCRIPTION" /><link rel="next" href="sql-altertable.html" title="ALTER TABLE" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">ALTER SYSTEM</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-altersubscription.html" title="ALTER SUBSCRIPTION">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-altertable.html" title="ALTER TABLE">Next</a></td></tr></table><hr /></div><div class="refentry" id="SQL-ALTERSYSTEM"><div class="titlepage"></div><a id="id-1.9.3.34.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">ALTER SYSTEM</span></h2><p>ALTER SYSTEM — change a server configuration parameter</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
3 ALTER SYSTEM SET <em class="replaceable"><code>configuration_parameter</code></em> { TO | = } { <em class="replaceable"><code>value</code></em> [, ...] | DEFAULT }
5 ALTER SYSTEM RESET <em class="replaceable"><code>configuration_parameter</code></em>
7 </pre></div><div class="refsect1" id="id-1.9.3.34.5"><h2>Description</h2><p>
8 <code class="command">ALTER SYSTEM</code> is used for changing server configuration
9 parameters across the entire database cluster. It can be more convenient
10 than the traditional method of manually editing
11 the <code class="filename">postgresql.conf</code> file.
12 <code class="command">ALTER SYSTEM</code> writes the given parameter setting to
13 the <code class="filename">postgresql.auto.conf</code> file, which is read in
14 addition to <code class="filename">postgresql.conf</code>.
15 Setting a parameter to <code class="literal">DEFAULT</code>, or using the
16 <code class="command">RESET</code> variant, removes that configuration entry from the
17 <code class="filename">postgresql.auto.conf</code> file. Use <code class="literal">RESET
18 ALL</code> to remove all such configuration entries.
20 Values set with <code class="command">ALTER SYSTEM</code> will be effective after
21 the next server configuration reload, or after the next server restart
22 in the case of parameters that can only be changed at server start.
23 A server configuration reload can be commanded by calling the SQL
24 function <code class="function">pg_reload_conf()</code>, running <code class="literal">pg_ctl reload</code>,
25 or sending a <span class="systemitem">SIGHUP</span> signal to the main server process.
27 Only superusers and users granted <code class="literal">ALTER SYSTEM</code> privilege
28 on a parameter can change it using <code class="command">ALTER SYSTEM</code>. Also, since
29 this command acts directly on the file system and cannot be rolled back,
30 it is not allowed inside a transaction block or function.
31 </p></div><div class="refsect1" id="id-1.9.3.34.6"><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>configuration_parameter</code></em></span></dt><dd><p>
32 Name of a settable configuration parameter. Available parameters are
33 documented in <a class="xref" href="runtime-config.html" title="Chapter 19. Server Configuration">Chapter 19</a>.
34 </p></dd><dt><span class="term"><em class="replaceable"><code>value</code></em></span></dt><dd><p>
35 New value of the parameter. Values can be specified as string
36 constants, identifiers, numbers, or comma-separated lists of
37 these, as appropriate for the particular parameter.
38 Values that are neither numbers nor valid identifiers must be quoted.
39 <code class="literal">DEFAULT</code> can be written to specify removing the
40 parameter and its value from <code class="filename">postgresql.auto.conf</code>.
42 For some list-accepting parameters, quoted values will produce
43 double-quoted output to preserve whitespace and commas; for others,
44 double-quotes must be used inside single-quoted strings to get
46 </p></dd></dl></div></div><div class="refsect1" id="id-1.9.3.34.7"><h2>Notes</h2><p>
47 This command can't be used to set <a class="xref" href="runtime-config-file-locations.html#GUC-DATA-DIRECTORY">data_directory</a>,
48 <a class="xref" href="runtime-config-compatible.html#GUC-ALLOW-ALTER-SYSTEM">allow_alter_system</a>,
49 nor parameters that are not allowed in <code class="filename">postgresql.conf</code>
50 (e.g., <a class="link" href="runtime-config-preset.html" title="19.15. Preset Options">preset options</a>).
52 See <a class="xref" href="config-setting.html" title="19.1. Setting Parameters">Section 19.1</a> for other ways to set the parameters.
54 <code class="literal">ALTER SYSTEM</code> can be disabled by setting
55 <a class="xref" href="runtime-config-compatible.html#GUC-ALLOW-ALTER-SYSTEM">allow_alter_system</a> to <code class="literal">off</code>, but this
56 is not a security mechanism (as explained in detail in the documentation for
58 </p></div><div class="refsect1" id="id-1.9.3.34.8"><h2>Examples</h2><p>
59 Set the <code class="literal">wal_level</code>:
60 </p><pre class="programlisting">
61 ALTER SYSTEM SET wal_level = replica;
64 Undo that, restoring whatever setting was effective
65 in <code class="filename">postgresql.conf</code>:
66 </p><pre class="programlisting">
67 ALTER SYSTEM RESET wal_level;
68 </pre></div><div class="refsect1" id="id-1.9.3.34.9"><h2>Compatibility</h2><p>
69 The <code class="command">ALTER SYSTEM</code> statement is a
70 <span class="productname">PostgreSQL</span> extension.
71 </p></div><div class="refsect1" id="id-1.9.3.34.10"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-set.html" title="SET"><span class="refentrytitle">SET</span></a>, <a class="xref" href="sql-show.html" title="SHOW"><span class="refentrytitle">SHOW</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-altersubscription.html" title="ALTER SUBSCRIPTION">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-altertable.html" title="ALTER TABLE">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ALTER SUBSCRIPTION </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> ALTER TABLE</td></tr></table></div></body></html>