aboutsummaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/alter_publication.sgml
blob: 858231fbcbfb16fa86bde9f6e8063dec4f30f51e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!--
doc/src/sgml/ref/alter_publication.sgml
PostgreSQL documentation
-->

<refentry id="SQL-ALTERPUBLICATION">
 <indexterm zone="sql-alterpublication">
  <primary>ALTER PUBLICATION</primary>
 </indexterm>

 <refmeta>
  <refentrytitle>ALTER PUBLICATION</refentrytitle>
  <manvolnum>7</manvolnum>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>ALTER PUBLICATION</refname>
  <refpurpose>change the definition of a publication</refpurpose>
 </refnamediv>

 <refsynopsisdiv>
<synopsis>
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> WITH ( <replaceable class="PARAMETER">option</replaceable> [, ... ] )

<phrase>where <replaceable class="PARAMETER">option</replaceable> can be:</phrase>

      PUBLISH INSERT | NOPUBLISH INSERT
    | PUBLISH UPDATE | NOPUBLISH UPDATE
    | PUBLISH DELETE | NOPUBLISH DELETE

ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_USER | SESSION_USER }
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> ADD TABLE [ ONLY ] <replaceable class="PARAMETER">table_name</replaceable> [ * ] [, ...]
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> SET TABLE [ ONLY ] <replaceable class="PARAMETER">table_name</replaceable> [ * ] [, ...]
ALTER PUBLICATION <replaceable class="PARAMETER">name</replaceable> DROP TABLE [ ONLY ] <replaceable class="PARAMETER">table_name</replaceable> [ * ] [, ...]
</synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   The first variant of this command listed in the synopsis can change
   all of the publication properties specified in
   <xref linkend="sql-createpublication">.  Properties not mentioned in the
   command retain their previous settings.  Database superusers can change any
   of these settings for any role.
  </para>

  <para>
   To alter the owner, you must also be a direct or indirect member of the new
   owning role. The new owner must have <literal>CREATE</literal> privilege on
   the database.  Also, the new owner of a <literal>FOR ALL TABLES</literal>
   publication must be a superuser.  However, a superuser can change the
   ownership of a publication while circumventing these restrictions.
  </para>

  <para>
   The other variants of this command deal with the table membership of the
   publication.  The <literal>SET TABLE</literal> clause will replace the
   list of tables in the publication with the specified one.
   The <literal>ADD TABLE</literal> and
   <literal>DROP TABLE</literal> will add and remove one or more tables from
   the publication.
  </para>
 </refsect1>

 <refsect1>
  <title>Parameters</title>

  <variablelist>
   <varlistentry>
    <term><replaceable class="parameter">name</replaceable></term>
    <listitem>
     <para>
      The name of an existing publication whose definition is to be altered.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">new_owner</replaceable></term>
    <listitem>
     <para>
      The user name of the new owner of the publication.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">new_name</replaceable></term>
    <listitem>
     <para>
      The new name for the publication.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>PUBLISH INSERT</literal></term>
    <term><literal>NOPUBLISH INSERT</literal></term>
    <term><literal>PUBLISH UPDATE</literal></term>
    <term><literal>NOPUBLISH UPDATE</literal></term>
    <term><literal>PUBLISH DELETE</literal></term>
    <term><literal>NOPUBLISH DELETE</literal></term>
    <listitem>
     <para>
      These clauses alter properties originally set by
      <xref linkend="SQL-CREATEPUBLICATION">.  See there for more information.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">table_name</replaceable></term>
    <listitem>
     <para>
      Name of an existing table.  If <literal>ONLY</> is specified before the
      table name, only that table is affected.  If <literal>ONLY</> is not
      specified, the table and all its descendant tables (if any) are
      affected.  Optionally, <literal>*</> can be specified after the table
      name to explicitly indicate that descendant tables are included.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1>
  <title>Examples</title>

  <para>
   Change the publication to not publish inserts:
<programlisting>
ALTER PUBLICATION noinsert WITH (NOPUBLISH INSERT);
</programlisting>
  </para>

  <para>
   Add some tables to the publication:
<programlisting>
ALTER PUBLICATION mypublication ADD TABLE users, departments;
</programlisting>
  </para>
 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   <command>ALTER PUBLICATION</command> is a <productname>PostgreSQL</>
   extension.
  </para>
 </refsect1>

 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-createpublication"></member>
   <member><xref linkend="sql-droppublication"></member>
  </simplelist>
 </refsect1>
</refentry>