gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 line
6.5KB

  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 V1.79.1" /><link rel="prev" href="sql-altersubscription.html" title="ALTER SUBSCRIPTION" /><link rel="next" href="sql-altertable.html" title="ALTER TABLE" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" 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 12.4 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></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> | '<em class="replaceable"><code>value</code></em>' | DEFAULT }
  4. ALTER SYSTEM RESET <em class="replaceable"><code>configuration_parameter</code></em>
  5. ALTER SYSTEM RESET ALL
  6. </pre></div><div class="refsect1" id="id-1.9.3.34.5"><h2>Description</h2><p>
  7. <code class="command">ALTER SYSTEM</code> is used for changing server configuration
  8. parameters across the entire database cluster. It can be more convenient
  9. than the traditional method of manually editing
  10. the <code class="filename">postgresql.conf</code> file.
  11. <code class="command">ALTER SYSTEM</code> writes the given parameter setting to
  12. the <code class="filename">postgresql.auto.conf</code> file, which is read in
  13. addition to <code class="filename">postgresql.conf</code>.
  14. Setting a parameter to <code class="literal">DEFAULT</code>, or using the
  15. <code class="command">RESET</code> variant, removes that configuration entry from the
  16. <code class="filename">postgresql.auto.conf</code> file. Use <code class="literal">RESET
  17. ALL</code> to remove all such configuration entries.
  18. </p><p>
  19. Values set with <code class="command">ALTER SYSTEM</code> will be effective after
  20. the next server configuration reload, or after the next server restart
  21. in the case of parameters that can only be changed at server start.
  22. A server configuration reload can be commanded by calling the SQL
  23. function <code class="function">pg_reload_conf()</code>, running <code class="literal">pg_ctl reload</code>,
  24. or sending a <span class="systemitem">SIGHUP</span> signal to the main server process.
  25. </p><p>
  26. Only superusers can use <code class="command">ALTER SYSTEM</code>. Also, since
  27. this command acts directly on the file system and cannot be rolled back,
  28. it is not allowed inside a transaction block or function.
  29. </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>
  30. Name of a settable configuration parameter. Available parameters are
  31. documented in <a class="xref" href="runtime-config.html" title="Chapter 19. Server Configuration">Chapter 19</a>.
  32. </p></dd><dt><span class="term"><em class="replaceable"><code>value</code></em></span></dt><dd><p>
  33. New value of the parameter. Values can be specified as string
  34. constants, identifiers, numbers, or comma-separated lists of
  35. these, as appropriate for the particular parameter.
  36. <code class="literal">DEFAULT</code> can be written to specify removing the
  37. parameter and its value from <code class="filename">postgresql.auto.conf</code>.
  38. </p></dd></dl></div></div><div class="refsect1" id="id-1.9.3.34.7"><h2>Notes</h2><p>
  39. This command can't be used to set <a class="xref" href="runtime-config-file-locations.html#GUC-DATA-DIRECTORY">data_directory</a>,
  40. nor parameters that are not allowed in <code class="filename">postgresql.conf</code>
  41. (e.g., <a class="link" href="runtime-config-preset.html" title="19.15. Preset Options">preset options</a>).
  42. </p><p>
  43. See <a class="xref" href="config-setting.html" title="19.1. Setting Parameters">Section 19.1</a> for other ways to set the parameters.
  44. </p></div><div class="refsect1" id="id-1.9.3.34.8"><h2>Examples</h2><p>
  45. Set the <code class="literal">wal_level</code>:
  46. </p><pre class="programlisting">
  47. ALTER SYSTEM SET wal_level = replica;
  48. </pre><p>
  49. </p><p>
  50. Undo that, restoring whatever setting was effective
  51. in <code class="filename">postgresql.conf</code>:
  52. </p><pre class="programlisting">
  53. ALTER SYSTEM RESET wal_level;
  54. </pre></div><div class="refsect1" id="id-1.9.3.34.9"><h2>Compatibility</h2><p>
  55. The <code class="command">ALTER SYSTEM</code> statement is a
  56. <span class="productname">PostgreSQL</span> extension.
  57. </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">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-altertable.html">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">Home</a></td><td width="40%" align="right" valign="top"> ALTER TABLE</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1