@@ -32,20 +32,21 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
32
32
<title>Description</title>
33
33
34
34
<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.
38
38
</para>
39
39
40
40
<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.
44
44
</para>
45
45
46
46
<para>
47
47
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.
49
50
</para>
50
51
51
52
<para>
@@ -73,14 +74,15 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
73
74
<term><literal>CONNECTION '<replaceable class="parameter">conninfo</replaceable>'</literal></term>
74
75
<listitem>
75
76
<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"/>.
78
80
</para>
79
81
</listitem>
80
82
</varlistentry>
81
83
82
84
<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>
84
86
<listitem>
85
87
<para>
86
88
Names of the publications on the publisher to subscribe to.
@@ -105,25 +107,23 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
105
107
<listitem>
106
108
<para>
107
109
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
111
114
<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>.)
112
119
</para>
113
120
114
121
<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
124
124
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>
127
127
for tables to be subscribed.
128
128
</para>
129
129
</listitem>
@@ -135,6 +135,8 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
135
135
<para>
136
136
Specifies whether the command should create the replication slot on
137
137
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.
138
140
</para>
139
141
</listitem>
140
142
</varlistentry>
@@ -143,8 +145,8 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
143
145
<term><literal>enabled</literal> (<type>boolean</type>)</term>
144
146
<listitem>
145
147
<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
148
150
is <literal>true</literal>.
149
151
</para>
150
152
</listitem>
@@ -154,15 +156,15 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
154
156
<term><literal>slot_name</literal> (<type>string</type>)</term>
155
157
<listitem>
156
158
<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.
159
161
</para>
160
162
161
163
<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
166
168
subscriptions must also have both <literal>enabled</literal> and
167
169
<literal>create_slot</literal> set to <literal>false</literal>.
168
170
</para>
@@ -172,7 +174,8 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
172
174
</para>
173
175
174
176
<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:
176
179
177
180
<variablelist>
178
181
@@ -183,14 +186,14 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
183
186
Specifies whether the subscription will request the publisher to
184
187
send the data in binary format (as opposed to text).
185
188
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
187
190
binary send and receive functions will be transferred in binary.
188
191
</para>
189
192
190
193
<para>
191
- When doing cross-version replication, it could happen that the
194
+ When doing cross-version replication, it could be that the
192
195
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
194
197
such a case, data transfer will fail, and
195
198
the <literal>binary</literal> option cannot be used.
196
199
</para>
@@ -201,8 +204,8 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
201
204
<term><literal>copy_data</literal> (<type>boolean</type>)</term>
202
205
<listitem>
203
206
<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.
206
209
The default is <literal>true</literal>.
207
210
</para>
208
211
</listitem>
@@ -212,9 +215,9 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
212
215
<term><literal>streaming</literal> (<type>boolean</type>)</term>
213
216
<listitem>
214
217
<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
218
221
subscriber as a whole.
219
222
</para>
220
223
</listitem>
@@ -261,18 +264,22 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl
261
264
</para>
262
265
263
266
<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.
267
273
</para>
268
274
269
275
<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>
276
283
to know the actual two-phase state.
277
284
</para>
278
285
0 commit comments