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.

87 lines
9.6KB

  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 SUBSCRIPTION</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-alterstatistics.html" title="ALTER STATISTICS" /><link rel="next" href="sql-altersystem.html" title="ALTER SYSTEM" /></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 SUBSCRIPTION</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-alterstatistics.html" title="ALTER STATISTICS">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-altersystem.html" title="ALTER SYSTEM">Next</a></td></tr></table><hr></hr></div><div class="refentry" id="SQL-ALTERSUBSCRIPTION"><div class="titlepage"></div><a id="id-1.9.3.33.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">ALTER SUBSCRIPTION</span></h2><p>ALTER SUBSCRIPTION — change the definition of a subscription</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
  3. ALTER SUBSCRIPTION <em class="replaceable"><code>name</code></em> CONNECTION '<em class="replaceable"><code>conninfo</code></em>'
  4. ALTER SUBSCRIPTION <em class="replaceable"><code>name</code></em> SET PUBLICATION <em class="replaceable"><code>publication_name</code></em> [, ...] [ WITH ( <em class="replaceable"><code>set_publication_option</code></em> [= <em class="replaceable"><code>value</code></em>] [, ... ] ) ]
  5. ALTER SUBSCRIPTION <em class="replaceable"><code>name</code></em> REFRESH PUBLICATION [ WITH ( <em class="replaceable"><code>refresh_option</code></em> [= <em class="replaceable"><code>value</code></em>] [, ... ] ) ]
  6. ALTER SUBSCRIPTION <em class="replaceable"><code>name</code></em> ENABLE
  7. ALTER SUBSCRIPTION <em class="replaceable"><code>name</code></em> DISABLE
  8. ALTER SUBSCRIPTION <em class="replaceable"><code>name</code></em> SET ( <em class="replaceable"><code>subscription_parameter</code></em> [= <em class="replaceable"><code>value</code></em>] [, ... ] )
  9. ALTER SUBSCRIPTION <em class="replaceable"><code>name</code></em> OWNER TO { <em class="replaceable"><code>new_owner</code></em> | CURRENT_USER | SESSION_USER }
  10. ALTER SUBSCRIPTION <em class="replaceable"><code>name</code></em> RENAME TO <em class="replaceable"><code>new_name</code></em>
  11. </pre></div><div class="refsect1" id="id-1.9.3.33.5"><h2>Description</h2><p>
  12. <code class="command">ALTER SUBSCRIPTION</code> can change most of the subscription
  13. properties that can be specified
  14. in <a class="xref" href="sql-createsubscription.html" title="CREATE SUBSCRIPTION"><span class="refentrytitle">CREATE SUBSCRIPTION</span></a>.
  15. </p><p>
  16. You must own the subscription to use <code class="command">ALTER SUBSCRIPTION</code>.
  17. To alter the owner, you must also be a direct or indirect member of the
  18. new owning role. The new owner has to be a superuser.
  19. (Currently, all subscription owners must be superusers, so the owner checks
  20. will be bypassed in practice. But this might change in the future.)
  21. </p></div><div class="refsect1" id="id-1.9.3.33.6"><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd><p>
  22. The name of a subscription whose properties are to be altered.
  23. </p></dd><dt><span class="term"><code class="literal">CONNECTION '<em class="replaceable"><code>conninfo</code></em>'</code></span></dt><dd><p>
  24. This clause alters the connection property originally set by
  25. <a class="xref" href="sql-createsubscription.html" title="CREATE SUBSCRIPTION"><span class="refentrytitle">CREATE SUBSCRIPTION</span></a>. See there for more
  26. information.
  27. </p></dd><dt><span class="term"><code class="literal">SET PUBLICATION <em class="replaceable"><code>publication_name</code></em></code></span></dt><dd><p>
  28. Changes list of subscribed publications. See
  29. <a class="xref" href="sql-createsubscription.html" title="CREATE SUBSCRIPTION"><span class="refentrytitle">CREATE SUBSCRIPTION</span></a> for more information.
  30. By default this command will also act like <code class="literal">REFRESH
  31. PUBLICATION</code>.
  32. </p><p>
  33. <em class="replaceable"><code>set_publication_option</code></em> specifies additional
  34. options for this operation. The supported options are:
  35. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">refresh</code> (<code class="type">boolean</code>)</span></dt><dd><p>
  36. When false, the command will not try to refresh table information.
  37. <code class="literal">REFRESH PUBLICATION</code> should then be executed separately.
  38. The default is <code class="literal">true</code>.
  39. </p></dd></dl></div><p>
  40. Additionally, refresh options as described
  41. under <code class="literal">REFRESH PUBLICATION</code> may be specified.
  42. </p></dd><dt><span class="term"><code class="literal">REFRESH PUBLICATION</code></span></dt><dd><p>
  43. Fetch missing table information from publisher. This will start
  44. replication of tables that were added to the subscribed-to publications
  45. since the last invocation of <code class="command">REFRESH PUBLICATION</code> or
  46. since <code class="command">CREATE SUBSCRIPTION</code>.
  47. </p><p>
  48. <em class="replaceable"><code>refresh_option</code></em> specifies additional options for the
  49. refresh operation. The supported options are:
  50. </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">copy_data</code> (<code class="type">boolean</code>)</span></dt><dd><p>
  51. Specifies whether the existing data in the publications that are
  52. being subscribed to should be copied once the replication starts.
  53. The default is <code class="literal">true</code>. (Previously subscribed
  54. tables are not copied.)
  55. </p></dd></dl></div><p>
  56. </p></dd><dt><span class="term"><code class="literal">ENABLE</code></span></dt><dd><p>
  57. Enables the previously disabled subscription, starting the logical
  58. replication worker at the end of transaction.
  59. </p></dd><dt><span class="term"><code class="literal">DISABLE</code></span></dt><dd><p>
  60. Disables the running subscription, stopping the logical replication
  61. worker at the end of transaction.
  62. </p></dd><dt><span class="term"><code class="literal">SET ( <em class="replaceable"><code>subscription_parameter</code></em> [= <em class="replaceable"><code>value</code></em>] [, ... ] )</code></span></dt><dd><p>
  63. This clause alters parameters originally set by
  64. <a class="xref" href="sql-createsubscription.html" title="CREATE SUBSCRIPTION"><span class="refentrytitle">CREATE SUBSCRIPTION</span></a>. See there for more
  65. information. The allowed options are <code class="literal">slot_name</code> and
  66. <code class="literal">synchronous_commit</code>
  67. </p></dd><dt><span class="term"><em class="replaceable"><code>new_owner</code></em></span></dt><dd><p>
  68. The user name of the new owner of the subscription.
  69. </p></dd><dt><span class="term"><em class="replaceable"><code>new_name</code></em></span></dt><dd><p>
  70. The new name for the subscription.
  71. </p></dd></dl></div></div><div class="refsect1" id="id-1.9.3.33.7"><h2>Examples</h2><p>
  72. Change the publication subscribed by a subscription to
  73. <code class="literal">insert_only</code>:
  74. </p><pre class="programlisting">
  75. ALTER SUBSCRIPTION mysub SET PUBLICATION insert_only;
  76. </pre><p>
  77. </p><p>
  78. Disable (stop) the subscription:
  79. </p><pre class="programlisting">
  80. ALTER SUBSCRIPTION mysub DISABLE;
  81. </pre></div><div class="refsect1" id="id-1.9.3.33.8"><h2>Compatibility</h2><p>
  82. <code class="command">ALTER SUBSCRIPTION</code> is a <span class="productname">PostgreSQL</span>
  83. extension.
  84. </p></div><div class="refsect1" id="id-1.9.3.33.9"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-createsubscription.html" title="CREATE SUBSCRIPTION"><span class="refentrytitle">CREATE SUBSCRIPTION</span></a>, <a class="xref" href="sql-dropsubscription.html" title="DROP SUBSCRIPTION"><span class="refentrytitle">DROP SUBSCRIPTION</span></a>, <a class="xref" href="sql-createpublication.html" title="CREATE PUBLICATION"><span class="refentrytitle">CREATE PUBLICATION</span></a>, <a class="xref" href="sql-alterpublication.html" title="ALTER PUBLICATION"><span class="refentrytitle">ALTER PUBLICATION</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-alterstatistics.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-altersystem.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ALTER STATISTICS </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ALTER SYSTEM</td></tr></table></div></body></html>
上海开阖软件有限公司 沪ICP备12045867号-1