Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0c2c81b

Browse files
committed
doc: Add replication parameter to libpq documentation
Author: Michael Paquier <michael@paquier.xyz> Reported-by: Şahap Aşçı <sahapasci@gmail.com> Reviewed-by: Vik Fearing <vik.fearing@2ndquadrant.com>
1 parent 8aa75e1 commit 0c2c81b

File tree

2 files changed

+84
-10
lines changed

2 files changed

+84
-10
lines changed

doc/src/sgml/libpq.sgml

+58
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,64 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname
12621262
</listitem>
12631263
</varlistentry>
12641264

1265+
<varlistentry id="libpq-connect-replication" xreflabel="replication">
1266+
<term><literal>replication</literal></term>
1267+
<listitem>
1268+
<para>
1269+
This option determines whether the connection should use the
1270+
replication protocol instead of the normal protocol. This is what
1271+
PostgreSQL replication connections as well as tools such as
1272+
<application>pg_basebackup</application> use internally, but it can
1273+
also be used by third-party applications. For a description of the
1274+
replication protocol, consult <xref linkend="protocol-replication"/>.
1275+
</para>
1276+
1277+
<para>
1278+
The following values, which are case-insensitive, are supported:
1279+
<variablelist>
1280+
<varlistentry>
1281+
<term>
1282+
<literal>true</literal>, <literal>on</literal>,
1283+
<literal>yes</literal>, <literal>1</literal>
1284+
</term>
1285+
<listitem>
1286+
<para>
1287+
The connection goes into physical replication mode.
1288+
</para>
1289+
</listitem>
1290+
</varlistentry>
1291+
1292+
<varlistentry>
1293+
<term><literal>database</literal></term>
1294+
<listitem>
1295+
<para>
1296+
The connection goes into logical replication mode, connecting to
1297+
the database specified in the <literal>dbname</literal> parameter.
1298+
</para>
1299+
</listitem>
1300+
</varlistentry>
1301+
1302+
<varlistentry>
1303+
<term>
1304+
<literal>false</literal>, <literal>off</literal>,
1305+
<literal>no</literal>, <literal>0</literal>
1306+
</term>
1307+
<listitem>
1308+
<para>
1309+
The connection is a regular one, which is the default behavior.
1310+
</para>
1311+
</listitem>
1312+
</varlistentry>
1313+
</variablelist>
1314+
</para>
1315+
1316+
<para>
1317+
In physical or logical replication mode, only the simple query protocol
1318+
can be used.
1319+
</para>
1320+
</listitem>
1321+
</varlistentry>
1322+
12651323
<varlistentry id="libpq-connect-sslmode" xreflabel="sslmode">
12661324
<term><literal>sslmode</literal></term>
12671325
<listitem>

doc/src/sgml/protocol.sgml

+26-10
Original file line numberDiff line numberDiff line change
@@ -1635,16 +1635,27 @@ that cannot support <literal>tls-unique</literal> for some reason.
16351635

16361636
<para>
16371637
To initiate streaming replication, the frontend sends the
1638-
<literal>replication</literal> parameter in the startup message. A Boolean value
1639-
of <literal>true</literal> tells the backend to go into walsender mode, wherein a
1640-
small set of replication commands can be issued instead of SQL statements. Only
1641-
the simple query protocol can be used in walsender mode.
1642-
Replication commands are logged in the server log when
1643-
<xref linkend="guc-log-replication-commands"/> is enabled.
1644-
Passing <literal>database</literal> as the value instructs walsender to connect to
1645-
the database specified in the <literal>dbname</literal> parameter, which will allow
1646-
the connection to be used for logical replication from that database.
1638+
<literal>replication</literal> parameter in the startup message. A Boolean
1639+
value of <literal>true</literal> (or <literal>on</literal>,
1640+
<literal>yes</literal>, <literal>1</literal>) tells the backend to go into
1641+
physical replication walsender mode, wherein a small set of replication
1642+
commands, shown below, can be issued instead of SQL statements.
1643+
</para>
1644+
1645+
<para>
1646+
Passing <literal>database</literal> as the value for the
1647+
<literal>replication</literal> parameter instructs the backend to go into
1648+
logical replication walsender mode, connecting to the database specified in
1649+
the <literal>dbname</literal> parameter. In logical replication walsender
1650+
mode, the replication commands shown below as well as normal SQL commands can
1651+
be issued.
1652+
</para>
1653+
1654+
<para>
1655+
In either physical replication or logical replication walsender mode, only the
1656+
simple query protocol can be used.
16471657
</para>
1658+
16481659
<para>
16491660
For the purpose of testing replication commands, you can make a replication
16501661
connection via <application>psql</application> or any other <literal>libpq</literal>-using
@@ -1659,7 +1670,12 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;"
16591670
</para>
16601671

16611672
<para>
1662-
The commands accepted in walsender mode are:
1673+
Replication commands are logged in the server log when
1674+
<xref linkend="guc-log-replication-commands"/> is enabled.
1675+
</para>
1676+
1677+
<para>
1678+
The commands accepted in replication mode are:
16631679
<variablelist>
16641680
<varlistentry>
16651681
<term><literal>IDENTIFY_SYSTEM</literal>

0 commit comments

Comments
 (0)