pg_recvlogical -- Control logical decoding (see Глава 46) streams over a walsender connection.


pg_recvlogical [option...]


pg_recvlogical controls logical decoding replication slots and streams data from such replication slots.

It creates a replication-mode connection, so it is subject to the same constraints as pg_receivexlog, plus those for logical replication (see Глава 46).


pg_recvlogical runs in one of three modes, which control its primary action:


Create a new logical replication slot with the name specified in --slot, using the output plugin --plugin, then exit. The slot is created for the database given in --dbname.


Begin streaming changes from the logical replication slot with the name specified in --slot, continuing until terminated with a signal. If the server side change stream ends with a server shutdown or disconnect, retry in a loop unless --no-loop is specified. The stream format is determined by the output plugin specified when the slot was created.

You must connect to the same database used to create the slot.


Drop the replication slot with the name specified in --slot, then exit.

pg_recvlogical supports all the usual libpq-based options. These are explained in detail in the documentation for psql and for libpq.

-U user
--username user

Username to connect as. Must have a suitable pg_hba.conf entry allowing replication connections. Defaults to current operating system user name.

-d database
--dbname database

The database to connect to in replication mode; see mode descriptions for details. May be a libpq connstring instead. Defaults to user name.

-h hostname-or-ip
--host hostname-or-ip

Host or socket to connect to. See psql and libpq documentation.

-p port
--port port

Port number to connect to. See psql for an explanation of default port choices when this is not specified.


Prevent prompting for a password. Will exit with an error code if a password is required but not available.


Provide a password for this connection. Please use the pgservice file (see Section 31.16) or an environment variable instead of this option.

The following command-line options control the location and format of the output and other replication behaviour:

-f filename

Write received and decoded transaction data into this file. Use - for stdout.


When the connection to the server is lost, do not retry in a loop, just exit.


Pass the option NAME to the output plugin with, if specified, the option value NAME. Which options exist and their effects depends on the used output plugin.

-F interval_seconds

How often should pg_receivexlog issue sync commands to ensure the --outputfile is safely flushed to disk without being asked by the server to do so. Specifying an interval of 0 disables issuing fsyncs altogether, while still reporting progress the server. In this case, data may be lost in the event of a crash.

-P plugin

When creating a slot, use the logical decoding output plugin. See Глава 46. This option has no effect if the slot already exists.

-s interval_seconds

This option has the same effect as the option of the same name in pg_receivexlog. See the description there.

-S slot_name

In --start mode, use the existing logical replication slot named slot_name. In --create mode, create the slot with this name. In --drop mode, delete the slot with this name.

-I lsn

In --start mode, start replication from the given LSN. For details on the effect of this, see the documentation in Глава 46 and Section 49.3. Ignored in other modes.

The following additional options are available:


Enables verbose mode.


Print the pg_recvlogical version and exit.


Show help about pg_recvlogical command line arguments, and exit.

    Поддержать сайт на родительском проекте КГБ