@@ -32,20 +32,21 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
3232 <title>Description</title>
3333
3434 <para>
35- <command>CREATE SUBSCRIPTION</command> adds a new subscription for the
36- current database . The subscription name must be distinct from the name of
37- any existing subscription in the database.
35+ <command>CREATE SUBSCRIPTION</command> adds a new logical-replication
36+ subscription . The subscription name must be distinct from the name of
37+ any existing subscription in the current database.
3838 </para>
3939
4040 <para>
41- The subscription represents a replication connection to the publisher. As
42- such this command does not only add definitions in the local catalogs but
43- also creates a replication slot on the publisher.
41+ A subscription represents a replication connection to the publisher.
42+ Hence, in addition to adding definitions in the local catalogs, this
43+ command normally creates a replication slot on the publisher.
4444 </para>
4545
4646 <para>
4747 A logical replication worker will be started to replicate data for the new
48- subscription at the commit of the transaction where this command is run.
48+ subscription at the commit of the transaction where this command is run,
49+ unless the subscription is initially disabled.
4950 </para>
5051
5152 <para>
@@ -73,14 +74,15 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
7374 <term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
7475 <listitem>
7576 <para>
76- The connection string to the publisher. For details
77- see <xref linkend="libpq-connstring"/>.
77+ The <application>libpq</application> connection string defining how
78+ to connect to the publisher database. For details see
79+ <xref linkend="libpq-connstring"/>.
7880 </para>
7981 </listitem>
8082 </varlistentry>
8183
8284 <varlistentry>
83- <term><literal>PUBLICATION <replaceable class="parameter">publication_name</replaceable></literal></term>
85+ <term><literal>PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...] </literal></term>
8486 <listitem>
8587 <para>
8688 Names of the publications on the publisher to subscribe to.
@@ -105,25 +107,23 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
105107 <listitem>
106108 <para>
107109 Specifies whether the <command>CREATE SUBSCRIPTION</command>
108- should connect to the publisher at all. Setting this to
109- <literal>false</literal> will change default values of
110- <literal>enabled</literal>, <literal>create_slot</literal> and
110+ command should connect to the publisher at all. The default
111+ is <literal>true</literal>. Setting this to
112+ <literal>false</literal> will force the values of
113+ <literal>create_slot</literal>, <literal>enabled</literal> and
111114 <literal>copy_data</literal> to <literal>false</literal>.
115+ (You cannot combine setting <literal>connect</literal>
116+ to <literal>false</literal> with
117+ setting <literal>create_slot</literal>, <literal>enabled</literal>,
118+ or <literal>copy_data</literal> to <literal>true</literal>.)
112119 </para>
113120
114121 <para>
115- It is not allowed to combine <literal>connect</literal> set to
116- <literal>false</literal> and <literal>enabled</literal>,
117- <literal>create_slot</literal>, or <literal>copy_data</literal>
118- set to <literal>true</literal>.
119- </para>
120-
121- <para>
122- Since no connection is made when this option is set
123- to <literal>false</literal>, the tables are not subscribed, and so
122+ Since no connection is made when this option is
123+ <literal>false</literal>, no tables are subscribed, and so
124124 after you enable the subscription nothing will be replicated.
125- It is required to run
126- <literal>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</literal> in order
125+ You will need to then run
126+ <literal>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</literal>
127127 for tables to be subscribed.
128128 </para>
129129 </listitem>
@@ -135,6 +135,8 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
135135 <para>
136136 Specifies whether the command should create the replication slot on
137137 the publisher. The default is <literal>true</literal>.
138+ If set to <literal>false</literal>, you are responsible for
139+ creating the publisher's slot in some other way.
138140 </para>
139141 </listitem>
140142 </varlistentry>
@@ -143,8 +145,8 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
143145 <term><literal>enabled</literal> (<type>boolean</type>)</term>
144146 <listitem>
145147 <para>
146- Specifies whether the subscription should be actively replicating,
147- or whether it should be just setup but not started yet. The default
148+ Specifies whether the subscription should be actively replicating
149+ or whether it should just be set up but not started yet. The default
148150 is <literal>true</literal>.
149151 </para>
150152 </listitem>
@@ -154,15 +156,15 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
154156 <term><literal>slot_name</literal> (<type>string</type>)</term>
155157 <listitem>
156158 <para>
157- Name of the replication slot to use. The default behavior is to
158- use the name of the subscription for the slot name.
159+ Name of the publisher's replication slot to use. The default is
160+ to use the name of the subscription for the slot name.
159161 </para>
160162
161163 <para>
162- When <literal>slot_name</literal> is set to
163- <literal>NONE</literal>, there will be no replication slot
164- associated with the subscription. This can be used if the
165- replication slot will be created later manually. Such
164+ Setting <literal>slot_name</literal> to <literal>NONE</literal>
165+ means there will be no replication slot
166+ associated with the subscription. Use this when you will be
167+ creating the replication slot later manually. Such
166168 subscriptions must also have both <literal>enabled</literal> and
167169 <literal>create_slot</literal> set to <literal>false</literal>.
168170 </para>
@@ -172,7 +174,8 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
172174 </para>
173175
174176 <para>
175- The following parameters control the replication behavior:
177+ The following parameters control the subscription's replication
178+ behavior after it has been created:
176179
177180 <variablelist>
178181
@@ -183,14 +186,14 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
183186 Specifies whether the subscription will request the publisher to
184187 send the data in binary format (as opposed to text).
185188 The default is <literal>false</literal>.
186- Even when this option is enabled, only data types that have
189+ Even when this option is enabled, only data types having
187190 binary send and receive functions will be transferred in binary.
188191 </para>
189192
190193 <para>
191- When doing cross-version replication, it could happen that the
194+ When doing cross-version replication, it could be that the
192195 publisher has a binary send function for some data type, but the
193- subscriber lacks a binary receive function for the type. In
196+ subscriber lacks a binary receive function for that type. In
194197 such a case, data transfer will fail, and
195198 the <literal>binary</literal> option cannot be used.
196199 </para>
@@ -201,8 +204,8 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
201204 <term><literal>copy_data</literal> (<type>boolean</type>)</term>
202205 <listitem>
203206 <para>
204- Specifies whether the existing data in the publications that are
205- being subscribed to should be copied once the replication starts.
207+ Specifies whether to copy pre- existing data in the publications
208+ that are being subscribed to when the replication starts.
206209 The default is <literal>true</literal>.
207210 </para>
208211 </listitem>
@@ -212,9 +215,9 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
212215 <term><literal>streaming</literal> (<type>boolean</type>)</term>
213216 <listitem>
214217 <para>
215- Specifies whether streaming of in-progress transactions should
216- be enabled for this subscription. By default, all transactions
217- are fully decoded on the publisher, and only then sent to the
218+ Specifies whether to enable streaming of in-progress transactions
219+ for this subscription. By default, all transactions
220+ are fully decoded on the publisher and only then sent to the
218221 subscriber as a whole.
219222 </para>
220223 </listitem>
@@ -261,18 +264,22 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
261264 </para>
262265
263266 <para>
264- When two-phase commit is enabled then the decoded transactions are sent
265- to the subscriber on the PREPARE TRANSACTION. By default, the transaction
266- prepared on the publisher is decoded as a normal transaction at commit.
267+ When two-phase commit is enabled, prepared transactions are sent
268+ to the subscriber at the time of <command>PREPARE
269+ TRANSACTION</command>, and are processed as two-phase
270+ transactions on the subscriber too. Otherwise, prepared
271+ transactions are sent to the subscriber only when committed, and
272+ are then processed immediately by the subscriber.
267273 </para>
268274
269275 <para>
270- The two-phase commit implementation requires that the replication has
271- successfully passed the initial table synchronization phase. This means
272- even when two_phase is enabled for the subscription, the internal
273- two-phase state remains temporarily "pending" until the initialization
274- phase is completed. See column
275- <literal>subtwophasestate</literal> of <xref linkend="catalog-pg-subscription"/>
276+ The implementation of two-phase commit requires that replication
277+ has successfully finished the initial table synchronization
278+ phase. So even when <literal>two_phase</literal> is enabled for a
279+ subscription, the internal two-phase state remains
280+ temporarily <quote>pending</quote> until the initialization phase
281+ completes. See column <structfield>subtwophasestate</structfield>
282+ of <link linkend="catalog-pg-subscription"><structname>pg_subscription</structname></link>
276283 to know the actual two-phase state.
277284 </para>
278285
0 commit comments