pg_recvlogical — control PostgreSQL logical decoding streams
pg_recvlogical controls logical decoding replication slots and streams data from such replication slots.
At least one of the following options must be specified to select an action:
Create a new logical replication slot with the name specified by
--slot, using the output plugin specified by
--plugin, for the database specified by
Drop the replication slot with the name specified by
--slot, then exit.
Begin streaming changes from the logical replication slot specified by
--slot, continuing until terminated by a signal. If the server side change stream ends with a server shutdown or disconnect, retry in a loop unless
The stream format is determined by the output plugin specified when the slot was created.
The connection must be to the same database used to create the slot.
--start can be specified together.
--drop-slot cannot be combined with another action.
The following command-line options control the location and format of the output and other replication behavior:
Write received and decoded transaction data into this file. Use
Specifies how often pg_recvlogical should issue
fsync()calls to ensure the output file is safely flushed to disk.
The server will occasionally request the client to perform a flush and report the flush position to the server. This setting is in addition to that, to perform flushes more frequently.
Specifying an interval of
fsync()calls altogether, while still reporting progress to the server. In this case, data could be lost in the event of a crash.
Do not error out when
--create-slotis specified and a slot with the specified name already exists.
When the connection to the server is lost, do not retry in a loop, just exit.
Pass the option
nameto the output plugin with, if specified, the option value
value. Which options exist and their effects depends on the used output plugin.
When creating a slot, use the specified logical decoding output plugin. See Chapter 47. This option has no effect if the slot already exists.
This option has the same effect as the option of the same name in pg_receivexlog. See the description there.
--startmode, use the existing logical replication slot named
--create-slotmode, create the slot with this name. In
--drop-slotmode, delete the slot with this name.
Enables verbose mode.
The following command-line options control the database connection parameters.
The database to connect to. See the description of the actions for what this means in detail. The
dbnamecan be a connection string. If so, connection string parameters will override any conflicting command line options. Defaults to the user name.
Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the
PGHOSTenvironment variable, if set, else a Unix domain socket connection is attempted.
Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the
PGPORTenvironment variable, if set, or a compiled-in default.
User name to connect as. Defaults to current operating system user name.
Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a
.pgpassfile, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.
Force pg_recvlogical to prompt for a password before connecting to a database.
This option is never essential, since pg_recvlogical will automatically prompt for a password if the server demands password authentication. However, pg_recvlogical will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing
-Wto avoid the extra connection attempt.
The following additional options are available:
Print the pg_recvlogical version and exit.
Show help about pg_recvlogical command line arguments, and exit.
This utility, like most other PostgreSQL utilities, uses the environment variables supported by libpq (see Section 32.14).
See Section 47.1 for an example.