PG_RECVLOGICAL(1)
π pg_recvlogical β PG_RECVLOGICAL(1) π
okay so this is the PostgreSQL 14.24 Documentation page for pg_recvlogical, and we're gonna make it make sense bestie. no cap, every flag is still here.
πΈ NAME πΈ
pg_recvlogical β control PostgreSQL logical decoding streams. slay.
β¨ SYNOPSIS β¨
pg_recvlogical [option...]
periodt.
π¦ DESCRIPTION π¦
pg_recvlogical controls logical decoding replication slots and streams data from such replication slots. it's giving main character energy for logical decoding.
It creates a replication-mode connection, so it is subject to the same constraints as pg_receivewal(1), plus those for logical replication (see Chapter 49).
pg_recvlogical has no equivalent to the logical decoding SQL interface's peek and get modes. It sends replay confirmations for data lazily as it receives it and on clean exit. To examine pending data on a slot without consuming it, use pg_logical_slot_peek_changes.
When pg_recvlogical receives a SIGHUP signal, it closes the current output file and opens a new one using the filename specified by the --file option. This allows us to rotate the output file by first renaming the current file and then sending a SIGHUP signal to pg_recvlogical. iconic file-rotation behavior honestly.
π OPTIONS π
At least one of the following options must be specified to select an action:
--create-slotβ create a new logical replication slot with the name specified by--slot, using the output plugin specified by--plugin, for the database specified by--dbname.--drop-slotβ drop the replication slot with the name specified by--slot, then exit.--startβ 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--no-loopis specified.
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.
--create-slot and --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:
-E lsn,--endpos=lsnβ in--startmode, automatically stop replication and exit with normal exit status0when receiving reaches the specified LSN. If specified when not in--startmode, an error is raised. If there's a record with LSN exactly equal tolsn, the record will be output. The--endposoption is not aware of transaction boundaries and may truncate output partway through a transaction. Any partially output transaction will not be consumed and will be replayed again when the slot is next read from. Individual messages are never truncated.-f filename,--file=filenameβ write received and decoded transaction data into this file. Use-for stdout.-F interval_seconds,--fsync-interval=interval_secondsβ specifies how oftenpg_recvlogicalshould issuefsync()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 of0disables issuingfsync()calls altogether, while still reporting progress to the server. In this case, data could be lost in the event of a crash.-I lsn,--startpos=lsnβ in--startmode, start replication from the given LSN. For details on the effect of this, see the documentation in Chapter 49 and Section 53.4. Ignored in other modes.--if-not-existsβ do not error out when--create-slotis specified and a slot with the specified name already exists.-n,--no-loopβ when the connection to the server is lost, do not retry in a loop, just exit.-o name[=value],--option=name[=value]β pass the optionnameto the output plugin with, if specified, the option valuevalue. Which options exist and their effects depends on the used output plugin.-P plugin,--plugin=pluginβ when creating a slot, use the specified logical decoding output plugin. See Chapter 49. This option has no effect if the slot already exists.-s interval_seconds,--status-interval=interval_secondsβ this option has the same effect as the option of the same name inpg_receivewal(1). See the description there.-S slot_name,--slot=slot_nameβ in--startmode, use the existing logical replication slot namedslot_name. In--create-slotmode, create the slot with this name. In--drop-slotmode, delete the slot with this name.-v,--verboseβ enables verbose mode.
The following command-line options control the database connection parameters.
-d dbname,--dbname=dbnameβ the database to connect to. See the description of the actions for what this means in detail. Thedbnamecan be a connection string. If so, connection string parameters will override any conflicting command line options. Defaults to the user name.-h hostname-or-ip,--host=hostname-or-ipβ 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 thePGHOSTenvironment variable, if set, else a Unix domain socket connection is attempted.-p port,--port=portβ specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to thePGPORTenvironment variable, if set, or a compiled-in default.-U user,--username=userβ user name to connect as. Defaults to current operating system user name.-w,--no-passwordβ 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.-W,--passwordβ forcepg_recvlogicalto prompt for a password before connecting to a database. This option is never essential, sincepg_recvlogicalwill automatically prompt for a password if the server demands password authentication. However,pg_recvlogicalwill 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:
-V,--versionβ print thepg_recvlogicalversion and exit.-?,--helpβ show help aboutpg_recvlogicalcommand line arguments, and exit.
π ENVIRONMENT π
This utility, like most other PostgreSQL utilities, uses the environment variables supported by libpq (see Section 34.15).
The environment variable PG_COLOR specifies whether to use color in diagnostic messages. Possible values are always, auto and never.
π NOTES π
pg_recvlogical will preserve group permissions on the output files if group permissions are enabled on the source cluster.
π EXAMPLES π
See Section 49.1 for an example.
π SEE ALSO π
okay bye bestie! this page is from PostgreSQL 14.24 documentation, dated 2026, and the footer is still PG_RECVLOGICAL(1) β mwah π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms