{"Entry":{"collection":"tool","key":"pg-recvlogical","name":"pg_recvlogical","aliases":["pg_recvlogical"],"metadata":{"aliases":["pg_recvlogical"],"category":"Client applications","content_hash":"6e51b4b791bf62502d105ef2553c57a513e6bc34c4a42b7a45b82dc8611d1672","imported_at":"2026-09-30T00:40:34.327881+08:00","name":"pg_recvlogical","name_zh":"","slug":"pg-recvlogical","summary":"pg_recvlogical — control PostgreSQL logical decoding streams"}},"Definition":{"Collection":"tool","Key":"pg-recvlogical","SourceDatabase":"center","Version":"18","SourceTable":"command_tool","SourceKey":"pg-recvlogical","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","Facts":{"comparison_data":{"environment":[],"options":[{"description":"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 . The --slot and --dbname are required for this action. The --enable-two-phase and --enable-failover options can be specified with --create-slot .","names":["--create-slot"],"signature":"--create-slot"},{"description":"Drop the replication slot with the name specified by --slot , then exit. The --slot is required for this action.","names":["--drop-slot"],"signature":"--drop-slot"},{"description":"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-loop is specified. The --slot and --dbname , --file are required for this action. 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.","names":["--start"],"signature":"--start"},{"description":"In --start mode, automatically stop replication and exit with normal exit status 0 when receiving reaches the specified LSN. If specified when not in --start mode, an error is raised. If there's a record with LSN exactly equal to lsn , the record will be output. The --endpos option 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.","names":["-E lsn","--endpos= lsn"],"signature":"-E lsn --endpos= lsn"},{"description":"Enables the slot to be synchronized to the standbys. This option may only be specified with --create-slot .","names":["--enable-failover"],"signature":"--enable-failover"},{"description":"Write received and decoded transaction data into this file. Use - for stdout . This parameter is required for --start .","names":["-f filename","--file= filename"],"signature":"-f filename --file= filename"},{"description":"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 0 disables issuing fsync() calls altogether, while still reporting progress to the server. In this case, data could be lost in the event of a crash.","names":["-F interval_seconds","--fsync-interval= interval_seconds"],"signature":"-F interval_seconds --fsync-interval= interval_seconds"},{"description":"In --start mode, start replication from the given LSN. For details on the effect of this, see the documentation in Chapter 47 and Section 54.4 . Ignored in other modes.","names":["-I lsn","--startpos= lsn"],"signature":"-I lsn --startpos= lsn"},{"description":"Do not error out when --create-slot is specified and a slot with the specified name already exists.","names":["--if-not-exists"],"signature":"--if-not-exists"},{"description":"When the connection to the server is lost, do not retry in a loop, just exit.","names":["-n","--no-loop"],"signature":"-n --no-loop"},{"description":"Pass the option name to the output plugin with, if specified, the option value value . Which options exist and their effects depends on the used output plugin.","names":["-o name [= value ]","--option= name [= value ]"],"signature":"-o name [= value ] --option= name [= value ]"},{"description":"When creating a slot, use the specified logical decoding output plugin. See Chapter 47 . This option has no effect if the slot already exists.","names":["-P plugin","--plugin= plugin"],"signature":"-P plugin --plugin= plugin"},{"description":"This option has the same effect as the option of the same name in pg_receivewal . See the description there.","names":["-s interval_seconds","--status-interval= interval_seconds"],"signature":"-s interval_seconds --status-interval= interval_seconds"},{"description":"In --start mode, use the existing logical replication slot named slot_name . In --create-slot mode, create the slot with this name. In --drop-slot mode, delete the slot with this name. This parameter is required for any of actions.","names":["-S slot_name","--slot= slot_name"],"signature":"-S slot_name --slot= slot_name"},{"description":"Enables decoding of prepared transactions. This option may only be specified with --create-slot .","names":["-t","--enable-two-phase","--two-phase"],"signature":"-t --enable-two-phase --two-phase (deprecated)"},{"description":"Enables verbose mode.","names":["-v","--verbose"],"signature":"-v --verbose"},{"description":"The database to connect to. See the description of the actions for what this means in detail. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options. This parameter is required for --create-slot and --start .","names":["-d dbname","--dbname= dbname"],"signature":"-d dbname --dbname= dbname"},{"description":"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 PGHOST environment variable, if set, else a Unix domain socket connection is attempted.","names":["-h hostname-or-ip","--host= hostname-or-ip"],"signature":"-h hostname-or-ip --host= hostname-or-ip"},{"description":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.","names":["-p port","--port= port"],"signature":"-p port --port= port"},{"description":"User name to connect as. Defaults to current operating system user name.","names":["-U user","--username= user"],"signature":"-U user --username= user"},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.","names":["-w","--no-password"],"signature":"-w --no-password"},{"description":"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 -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password"},{"description":"Print the pg_recvlogical version and exit.","names":["-V","--version"],"signature":"-V --version"},{"description":"Show help about pg_recvlogical command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help"}],"synopsis":["pg_recvlogical [ option ...]"]},"comparison_hash":"7e4d124b6d72f9dbcf5a935f6ef5cfdac9d56466c979b9dabadfcd070a54dfeb","description":["pg_recvlogical — control PostgreSQL logical decoding streams"],"environment":[],"facts":[{"label":"Documented executable","value":"pg_recvlogical"},{"label":"Executable version","value":"18.6"},{"label":"Reference inventory","value":"Client applications"},{"label":"Option definition groups","value":"24"}],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-PGRECVLOGICAL\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epg_recvlogical — control \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e logical decoding streams\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.18.4.1\"\u003e\u003ccode class=\"command\"\u003epg_recvlogical\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003epg_recvlogical\u003c/code\u003e controls logical decoding replication slots and streams data from such replication slots.\u003c/p\u003e\n\u003cp\u003eIt creates a replication-mode connection, so it is subject to the same constraints as \u003ca class=\"xref\" href=\"/docs/18/app-pgreceivewal.html\" title=\"pg_receivewal\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_receivewal\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, plus those for logical replication (see \u003ca class=\"xref\" href=\"/docs/18/logicaldecoding.html\" title=\"Chapter 47. Logical Decoding\"\u003eChapter 47\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003epg_recvlogical\u003c/code\u003e 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 \u003ca class=\"link\" href=\"/docs/18/functions-admin.html#FUNCTIONS-REPLICATION\" title=\"9.28.6. Replication Management Functions\"\u003e\u003ccode class=\"function\"\u003epg_logical_slot_peek_changes\u003c/code\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eIn the absence of fatal errors, \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e will run until terminated by the \u003cspan class=\"systemitem\"\u003eSIGINT\u003c/span\u003e (\u003cspan class=\"keycap\"\u003e\u003cstrong\u003eControl\u003c/strong\u003e\u003c/span\u003e+\u003cspan class=\"keycap\"\u003e\u003cstrong\u003eC\u003c/strong\u003e\u003c/span\u003e) or \u003cspan class=\"systemitem\"\u003eSIGTERM\u003c/span\u003e signal.\u003c/p\u003e\n\u003cp\u003eWhen \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e receives a \u003cspan class=\"systemitem\"\u003eSIGHUP\u003c/span\u003e signal, it closes the current output file and opens a new one using the filename specified by the \u003ccode class=\"option\"\u003e--file\u003c/code\u003e option. This allows us to rotate the output file by first renaming the current file and then sending a \u003cspan class=\"systemitem\"\u003eSIGHUP\u003c/span\u003e signal to \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003eAt least one of the following options must be specified to select an action:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eCreate a new logical replication slot with the name specified by \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e, using the output plugin specified by \u003ccode class=\"option\"\u003e--plugin\u003c/code\u003e, for the database specified by \u003ccode class=\"option\"\u003e--dbname\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e and \u003ccode class=\"option\"\u003e--dbname\u003c/code\u003e are required for this action.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--enable-two-phase\u003c/code\u003e and \u003ccode class=\"option\"\u003e--enable-failover\u003c/code\u003e options can be specified with \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--drop-slot\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDrop the replication slot with the name specified by \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e, then exit.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e is required for this action.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--start\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBegin streaming changes from the logical replication slot specified by \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e, continuing until terminated by a signal. If the server side change stream ends with a server shutdown or disconnect, retry in a loop unless \u003ccode class=\"option\"\u003e--no-loop\u003c/code\u003e is specified.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e and \u003ccode class=\"option\"\u003e--dbname\u003c/code\u003e, \u003ccode class=\"option\"\u003e--file\u003c/code\u003e are required for this action.\u003c/p\u003e\n\u003cp\u003eThe stream format is determined by the output plugin specified when the slot was created.\u003c/p\u003e\n\u003cp\u003eThe connection must be to the same database used to create the slot.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e and \u003ccode class=\"option\"\u003e--start\u003c/code\u003e can be specified together. \u003ccode class=\"option\"\u003e--drop-slot\u003c/code\u003e cannot be combined with another action.\u003c/p\u003e\n\u003cp\u003eThe following command-line options control the location and format of the output and other replication behavior:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E \u003cem class=\"replaceable\"\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--endpos=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIn \u003ccode class=\"option\"\u003e--start\u003c/code\u003e mode, automatically stop replication and exit with normal exit status 0 when receiving reaches the specified LSN. If specified when not in \u003ccode class=\"option\"\u003e--start\u003c/code\u003e mode, an error is raised.\u003c/p\u003e\n\u003cp\u003eIf there's a record with LSN exactly equal to \u003cem class=\"replaceable\"\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e, the record will be output.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--endpos\u003c/code\u003e option 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--enable-failover\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEnables the slot to be synchronized to the standbys. This option may only be specified with \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--file=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWrite received and decoded transaction data into this file. Use \u003ccode class=\"literal\"\u003e-\u003c/code\u003e for \u003cspan class=\"systemitem\"\u003estdout\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003eThis parameter is required for \u003ccode class=\"option\"\u003e--start\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F \u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval_seconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--fsync-interval=\u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval_seconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies how often \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e should issue \u003ccode class=\"function\"\u003efsync()\u003c/code\u003e calls to ensure the output file is safely flushed to disk.\u003c/p\u003e\n\u003cp\u003eThe 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.\u003c/p\u003e\n\u003cp\u003eSpecifying an interval of \u003ccode class=\"literal\"\u003e0\u003c/code\u003e disables issuing \u003ccode class=\"function\"\u003efsync()\u003c/code\u003e calls altogether, while still reporting progress to the server. In this case, data could be lost in the event of a crash.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-I \u003cem class=\"replaceable\"\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--startpos=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIn \u003ccode class=\"option\"\u003e--start\u003c/code\u003e mode, start replication from the given LSN. For details on the effect of this, see the documentation in \u003ca class=\"xref\" href=\"/docs/18/logicaldecoding.html\" title=\"Chapter 47. Logical Decoding\"\u003eChapter 47\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/protocol-replication.html\" title=\"54.4. Streaming Replication Protocol\"\u003eSection 54.4\u003c/a\u003e. Ignored in other modes.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--if-not-exists\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not error out when \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e is specified and a slot with the specified name already exists.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-loop\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen the connection to the server is lost, do not retry in a loop, just exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-o \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e[=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--option=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e[=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePass the option \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to the output plugin with, if specified, the option value \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e. Which options exist and their effects depends on the used output plugin.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P \u003cem class=\"replaceable\"\u003e\u003ccode\u003eplugin\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--plugin=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eplugin\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen creating a slot, use the specified logical decoding output plugin. See \u003ca class=\"xref\" href=\"/docs/18/logicaldecoding.html\" title=\"Chapter 47. Logical Decoding\"\u003eChapter 47\u003c/a\u003e. This option has no effect if the slot already exists.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s \u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval_seconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--status-interval=\u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval_seconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option has the same effect as the option of the same name in \u003ca class=\"xref\" href=\"/docs/18/app-pgreceivewal.html\" title=\"pg_receivewal\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_receivewal\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. See the description there.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S \u003cem class=\"replaceable\"\u003e\u003ccode\u003eslot_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--slot=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eslot_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIn \u003ccode class=\"option\"\u003e--start\u003c/code\u003e mode, use the existing logical replication slot named \u003cem class=\"replaceable\"\u003e\u003ccode\u003eslot_name\u003c/code\u003e\u003c/em\u003e. In \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e mode, create the slot with this name. In \u003ccode class=\"option\"\u003e--drop-slot\u003c/code\u003e mode, delete the slot with this name.\u003c/p\u003e\n\u003cp\u003eThis parameter is required for any of actions.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--enable-two-phase\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--two-phase\u003c/code\u003e (deprecated)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEnables decoding of prepared transactions. This option may only be specified with \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEnables verbose mode.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe following command-line options control the database connection parameters.\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--dbname=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe database to connect to. See the description of the actions for what this means in detail. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003cp\u003eThis parameter is required for \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e and \u003ccode class=\"option\"\u003e--start\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname-or-ip\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname-or-ip\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies 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 \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e environment variable, if set, else a Unix domain socket connection is attempted.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable, if set, or a compiled-in default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003euser\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003euser\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as. Defaults to current operating system user name.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe following additional options are available:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.7\"\u003e\n\u003ch2\u003eExit Status\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e will exit with status 0 when terminated by the \u003cspan class=\"systemitem\"\u003eSIGINT\u003c/span\u003e or \u003cspan class=\"systemitem\"\u003eSIGTERM\u003c/span\u003e signal. (That is the normal way to end it. Hence it is not an error.) For fatal errors or other signals, the exit status will be nonzero.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.8\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eThe environment variable \u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e specifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.9\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e will preserve group permissions on the output files if group permissions are enabled on the source cluster.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.10\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eSee \u003ca class=\"xref\" href=\"/docs/18/logicaldecoding-example.html\" title=\"47.1. Logical Decoding Examples\"\u003eSection 47.1\u003c/a\u003e for an example.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.11\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/app-pgreceivewal.html\" title=\"pg_receivewal\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_receivewal\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","manual_path":"app-pgrecvlogical.html","options":[{"description":"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 . The --slot and --dbname are required for this action. The --enable-two-phase and --enable-failover options can be specified with --create-slot .","names":["--create-slot"],"signature":"--create-slot","source_url":"/docs/18/app-pgrecvlogical.html","summary":"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 ."},{"description":"Drop the replication slot with the name specified by --slot , then exit. The --slot is required for this action.","names":["--drop-slot"],"signature":"--drop-slot","source_url":"/docs/18/app-pgrecvlogical.html","summary":"Drop the replication slot with the name specified by --slot , then exit."},{"description":"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-loop is specified. The --slot and --dbname , --file are required for this action. 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.","names":["--start"],"signature":"--start","source_url":"/docs/18/app-pgrecvlogical.html","summary":"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-loop is specified."},{"description":"In --start mode, automatically stop replication and exit with normal exit status 0 when receiving reaches the specified LSN. If specified when not in --start mode, an error is raised. If there's a record with LSN exactly equal to lsn , the record will be output. The --endpos option 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.","names":["-E lsn","--endpos= lsn"],"signature":"-E lsn --endpos= lsn","source_url":"/docs/18/app-pgrecvlogical.html","summary":"In --start mode, automatically stop replication and exit with normal exit status 0 when receiving reaches the specified LSN. If specified when not in --start mode, an error is raised."},{"description":"Enables the slot to be synchronized to the standbys. This option may only be specified with --create-slot .","names":["--enable-failover"],"signature":"--enable-failover","source_url":"/docs/18/app-pgrecvlogical.html","summary":"Enables the slot to be synchronized to the standbys. This option may only be specified with --create-slot ."},{"description":"Write received and decoded transaction data into this file. Use - for stdout . This parameter is required for --start .","names":["-f filename","--file= filename"],"signature":"-f filename --file= filename","source_url":"/docs/18/app-pgrecvlogical.html","summary":"Write received and decoded transaction data into this file. Use - for stdout ."},{"description":"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 0 disables issuing fsync() calls altogether, while still reporting progress to the server. In this case, data could be lost in the event of a crash.","names":["-F interval_seconds","--fsync-interval= interval_seconds"],"signature":"-F interval_seconds --fsync-interval= interval_seconds","source_url":"/docs/18/app-pgrecvlogical.html","summary":"Specifies how often pg_recvlogical should issue fsync() calls to ensure the output file is safely flushed to disk."},{"description":"In --start mode, start replication from the given LSN. For details on the effect of this, see the documentation in Chapter 47 and Section 54.4 . Ignored in other modes.","names":["-I lsn","--startpos= lsn"],"signature":"-I lsn --startpos= lsn","source_url":"/docs/18/app-pgrecvlogical.html","summary":"In --start mode, start replication from the given LSN. For details on the effect of this, see the documentation in Chapter 47 and Section 54.4 . Ignored in other modes."},{"description":"Do not error out when --create-slot is specified and a slot with the specified name already exists.","names":["--if-not-exists"],"signature":"--if-not-exists","source_url":"/docs/18/app-pgrecvlogical.html","summary":"Do not error out when --create-slot is specified and a slot with the specified name already exists."},{"description":"When the connection to the server is lost, do not retry in a loop, just exit.","names":["-n","--no-loop"],"signature":"-n --no-loop","source_url":"/docs/18/app-pgrecvlogical.html","summary":"When the connection to the server is lost, do not retry in a loop, just exit."},{"description":"Pass the option name to the output plugin with, if specified, the option value value . Which options exist and their effects depends on the used output plugin.","names":["-o name [= value ]","--option= name [= value ]"],"signature":"-o name [= value ] --option= name [= value ]","source_url":"/docs/18/app-pgrecvlogical.html","summary":"Pass the option name to the output plugin with, if specified, the option value value . Which options exist and their effects depends on the used output plugin."},{"description":"When creating a slot, use the specified logical decoding output plugin. See Chapter 47 . This option has no effect if the slot already exists.","names":["-P plugin","--plugin= plugin"],"signature":"-P plugin --plugin= plugin","source_url":"/docs/18/app-pgrecvlogical.html","summary":"When creating a slot, use the specified logical decoding output plugin. See Chapter 47 . This option has no effect if the slot already exists."},{"description":"This option has the same effect as the option of the same name in pg_receivewal . See the description there.","names":["-s interval_seconds","--status-interval= interval_seconds"],"signature":"-s interval_seconds --status-interval= interval_seconds","source_url":"/docs/18/app-pgrecvlogical.html","summary":"This option has the same effect as the option of the same name in pg_receivewal . See the description there."},{"description":"In --start mode, use the existing logical replication slot named slot_name . In --create-slot mode, create the slot with this name. In --drop-slot mode, delete the slot with this name. This parameter is required for any of actions.","names":["-S slot_name","--slot= slot_name"],"signature":"-S slot_name --slot= slot_name","source_url":"/docs/18/app-pgrecvlogical.html","summary":"In --start mode, use the existing logical replication slot named slot_name . In --create-slot mode, create the slot with this name. In --drop-slot mode, delete the slot with this name."},{"description":"Enables decoding of prepared transactions. This option may only be specified with --create-slot .","names":["-t","--enable-two-phase","--two-phase"],"signature":"-t --enable-two-phase --two-phase (deprecated)","source_url":"/docs/18/app-pgrecvlogical.html","summary":"Enables decoding of prepared transactions. This option may only be specified with --create-slot ."},{"description":"Enables verbose mode.","names":["-v","--verbose"],"signature":"-v --verbose","source_url":"/docs/18/app-pgrecvlogical.html","summary":"Enables verbose mode."},{"description":"The database to connect to. See the description of the actions for what this means in detail. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options. This parameter is required for --create-slot and --start .","names":["-d dbname","--dbname= dbname"],"signature":"-d dbname --dbname= dbname","source_url":"/docs/18/app-pgrecvlogical.html","summary":"The database to connect to. See the description of the actions for what this means in detail. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."},{"description":"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 PGHOST environment variable, if set, else a Unix domain socket connection is attempted.","names":["-h hostname-or-ip","--host= hostname-or-ip"],"signature":"-h hostname-or-ip --host= hostname-or-ip","source_url":"/docs/18/app-pgrecvlogical.html","summary":"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 PGHOST environment variable, if set, else a Unix domain socket connection is attempted."},{"description":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.","names":["-p port","--port= port"],"signature":"-p port --port= port","source_url":"/docs/18/app-pgrecvlogical.html","summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."},{"description":"User name to connect as. Defaults to current operating system user name.","names":["-U user","--username= user"],"signature":"-U user --username= user","source_url":"/docs/18/app-pgrecvlogical.html","summary":"User name to connect as. Defaults to current operating system user name."},{"description":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.","names":["-w","--no-password"],"signature":"-w --no-password","source_url":"/docs/18/app-pgrecvlogical.html","summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"description":"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 -W to avoid the extra connection attempt.","names":["-W","--password"],"signature":"-W --password","source_url":"/docs/18/app-pgrecvlogical.html","summary":"Force pg_recvlogical to prompt for a password before connecting to a database."},{"description":"Print the pg_recvlogical version and exit.","names":["-V","--version"],"signature":"-V --version","source_url":"/docs/18/app-pgrecvlogical.html","summary":"Print the pg_recvlogical version and exit."},{"description":"Show help about pg_recvlogical command line arguments, and exit.","names":["-?","--help"],"signature":"-? --help","source_url":"/docs/18/app-pgrecvlogical.html","summary":"Show help about pg_recvlogical command line arguments, and exit."}],"related":[{"label":"libpq connection parameters","url":"/wiki/conn/?v=18"}],"release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sections":[],"signature":"pg_recvlogical [ option ...]","sources":[{"anchor":"","file":"app-pgrecvlogical.html","label":"18.6 English manual · app-pgrecvlogical.html","sha256":"3052f6f3caa9b5cca077878cde0cd9f927a9489aaf13cc41209fa504c1327f39","url":"/docs/18/app-pgrecvlogical.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}],"synopsis":["pg_recvlogical [ option ...]"],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"--create-slot","url":"/docs/18/app-pgrecvlogical.html"},"summary":"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 ."},{"signature":{"text":"--drop-slot","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Drop the replication slot with the name specified by --slot , then exit."},{"signature":{"text":"--start","url":"/docs/18/app-pgrecvlogical.html"},"summary":"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-loop is specified."},{"signature":{"text":"-E lsn --endpos= lsn","url":"/docs/18/app-pgrecvlogical.html"},"summary":"In --start mode, automatically stop replication and exit with normal exit status 0 when receiving reaches the specified LSN. If specified when not in --start mode, an error is raised."},{"signature":{"text":"--enable-failover","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Enables the slot to be synchronized to the standbys. This option may only be specified with --create-slot ."},{"signature":{"text":"-f filename --file= filename","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Write received and decoded transaction data into this file. Use - for stdout ."},{"signature":{"text":"-F interval_seconds --fsync-interval= interval_seconds","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Specifies how often pg_recvlogical should issue fsync() calls to ensure the output file is safely flushed to disk."},{"signature":{"text":"-I lsn --startpos= lsn","url":"/docs/18/app-pgrecvlogical.html"},"summary":"In --start mode, start replication from the given LSN. For details on the effect of this, see the documentation in Chapter 47 and Section 54.4 . Ignored in other modes."},{"signature":{"text":"--if-not-exists","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Do not error out when --create-slot is specified and a slot with the specified name already exists."},{"signature":{"text":"-n --no-loop","url":"/docs/18/app-pgrecvlogical.html"},"summary":"When the connection to the server is lost, do not retry in a loop, just exit."},{"signature":{"text":"-o name [= value ] --option= name [= value ]","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Pass the option name to the output plugin with, if specified, the option value value . Which options exist and their effects depends on the used output plugin."},{"signature":{"text":"-P plugin --plugin= plugin","url":"/docs/18/app-pgrecvlogical.html"},"summary":"When creating a slot, use the specified logical decoding output plugin. See Chapter 47 . This option has no effect if the slot already exists."},{"signature":{"text":"-s interval_seconds --status-interval= interval_seconds","url":"/docs/18/app-pgrecvlogical.html"},"summary":"This option has the same effect as the option of the same name in pg_receivewal . See the description there."},{"signature":{"text":"-S slot_name --slot= slot_name","url":"/docs/18/app-pgrecvlogical.html"},"summary":"In --start mode, use the existing logical replication slot named slot_name . In --create-slot mode, create the slot with this name. In --drop-slot mode, delete the slot with this name."},{"signature":{"text":"-t --enable-two-phase --two-phase (deprecated)","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Enables decoding of prepared transactions. This option may only be specified with --create-slot ."},{"signature":{"text":"-v --verbose","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Enables verbose mode."},{"signature":{"text":"-d dbname --dbname= dbname","url":"/docs/18/app-pgrecvlogical.html"},"summary":"The database to connect to. See the description of the actions for what this means in detail. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."},{"signature":{"text":"-h hostname-or-ip --host= hostname-or-ip","url":"/docs/18/app-pgrecvlogical.html"},"summary":"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 PGHOST environment variable, if set, else a Unix domain socket connection is attempted."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."},{"signature":{"text":"-U user --username= user","url":"/docs/18/app-pgrecvlogical.html"},"summary":"User name to connect as. Defaults to current operating system user name."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Force pg_recvlogical to prompt for a password before connecting to a database."},{"signature":{"text":"-V --version","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Print the pg_recvlogical version and exit."},{"signature":{"text":"-? --help","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Show help about pg_recvlogical command line arguments, and exit."}],"title":"Documented options"}]},"ManualEvidence":{"manual_path":"app-pgrecvlogical.html","release":{"channel":"stable","evidence_kind":"English manual and source declarations","label":"18.6","major":"18","manifest":{"index":"index.html","major":"18","pages":1148,"pdf":{"A4":{"built_at":"2026-09-26","bytes":15865106,"pages":3154,"sha256":"19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190","url":"/files/documentation/pdf/18/postgresql-18-A4.pdf"},"US":{"built_at":"2026-09-26","bytes":15748059,"pages":3328,"sha256":"facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319","url":"/files/documentation/pdf/18/postgresql-18-US.pdf"}},"release":"18.6","source_mode":"en SGML built with pinned official archive","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","svg_assets":3,"tree":"18"},"ref":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2","revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","source_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"},"sources":[{"anchor":"","file":"app-pgrecvlogical.html","label":"18.6 English manual · app-pgrecvlogical.html","sha256":"3052f6f3caa9b5cca077878cde0cd9f927a9489aaf13cc41209fa504c1327f39","url":"/docs/18/app-pgrecvlogical.html"},{"anchor":"","file":"reference-client.html","label":"Client applications inventory","sha256":"68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0","url":"/docs/18/reference-client.html"}]},"MeasuredEvidence":{}},"Text":{"Collection":"tool","Key":"pg-recvlogical","SourceDatabase":"center","Version":"18","Locale":"en","Title":"pg_recvlogical","Summary":"pg_recvlogical — control PostgreSQL logical decoding streams","BodyHTML":"\u003cdiv\u003e\u003cdiv id=\"APP-PGRECVLOGICAL\"\u003e\n\u003cdiv\u003e\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003e\u003cspan\u003e\u003cspan\u003epg_recvlogical\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epg_recvlogical — control \u003cspan\u003ePostgreSQL\u003c/span\u003e logical decoding streams\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv\u003e\n\u003cp id=\"id-1.9.4.18.4.1\"\u003e\u003ccode\u003epg_recvlogical\u003c/code\u003e [\u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.18.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003epg_recvlogical\u003c/code\u003e controls logical decoding replication slots and streams data from such replication slots.\u003c/p\u003e\n\u003cp\u003eIt creates a replication-mode connection, so it is subject to the same constraints as \u003ca href=\"/docs/18/app-pgreceivewal.html\" title=\"pg_receivewal\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_receivewal\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, plus those for logical replication (see \u003ca href=\"/docs/18/logicaldecoding.html\" rel=\"nofollow\"\u003eChapter 47\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003epg_recvlogical\u003c/code\u003e has no equivalent to the logical decoding SQL interface\u0026#39;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 \u003ca href=\"/docs/18/functions-admin.html#FUNCTIONS-REPLICATION\" rel=\"nofollow\"\u003e\u003ccode\u003epg_logical_slot_peek_changes\u003c/code\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eIn the absence of fatal errors, \u003cspan\u003epg_recvlogical\u003c/span\u003e will run until terminated by the \u003cspan\u003eSIGINT\u003c/span\u003e (\u003cspan\u003e\u003cstrong\u003eControl\u003c/strong\u003e\u003c/span\u003e+\u003cspan\u003e\u003cstrong\u003eC\u003c/strong\u003e\u003c/span\u003e) or \u003cspan\u003eSIGTERM\u003c/span\u003e signal.\u003c/p\u003e\n\u003cp\u003eWhen \u003cspan\u003epg_recvlogical\u003c/span\u003e receives a \u003cspan\u003eSIGHUP\u003c/span\u003e signal, it closes the current output file and opens a new one using the filename specified by the \u003ccode\u003e--file\u003c/code\u003e option. This allows us to rotate the output file by first renaming the current file and then sending a \u003cspan\u003eSIGHUP\u003c/span\u003e signal to \u003cspan\u003epg_recvlogical\u003c/span\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.18.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003eAt least one of the following options must be specified to select an action:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--create-slot\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eCreate a new logical replication slot with the name specified by \u003ccode\u003e--slot\u003c/code\u003e, using the output plugin specified by \u003ccode\u003e--plugin\u003c/code\u003e, for the database specified by \u003ccode\u003e--dbname\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode\u003e--slot\u003c/code\u003e and \u003ccode\u003e--dbname\u003c/code\u003e are required for this action.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode\u003e--enable-two-phase\u003c/code\u003e and \u003ccode\u003e--enable-failover\u003c/code\u003e options can be specified with \u003ccode\u003e--create-slot\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--drop-slot\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDrop the replication slot with the name specified by \u003ccode\u003e--slot\u003c/code\u003e, then exit.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode\u003e--slot\u003c/code\u003e is required for this action.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--start\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBegin streaming changes from the logical replication slot specified by \u003ccode\u003e--slot\u003c/code\u003e, continuing until terminated by a signal. If the server side change stream ends with a server shutdown or disconnect, retry in a loop unless \u003ccode\u003e--no-loop\u003c/code\u003e is specified.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode\u003e--slot\u003c/code\u003e and \u003ccode\u003e--dbname\u003c/code\u003e, \u003ccode\u003e--file\u003c/code\u003e are required for this action.\u003c/p\u003e\n\u003cp\u003eThe stream format is determined by the output plugin specified when the slot was created.\u003c/p\u003e\n\u003cp\u003eThe connection must be to the same database used to create the slot.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ccode\u003e--create-slot\u003c/code\u003e and \u003ccode\u003e--start\u003c/code\u003e can be specified together. \u003ccode\u003e--drop-slot\u003c/code\u003e cannot be combined with another action.\u003c/p\u003e\n\u003cp\u003eThe following command-line options control the location and format of the output and other replication behavior:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-E \u003cem\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--endpos=\u003cem\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIn \u003ccode\u003e--start\u003c/code\u003e mode, automatically stop replication and exit with normal exit status 0 when receiving reaches the specified LSN. If specified when not in \u003ccode\u003e--start\u003c/code\u003e mode, an error is raised.\u003c/p\u003e\n\u003cp\u003eIf there\u0026#39;s a record with LSN exactly equal to \u003cem\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e, the record will be output.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode\u003e--endpos\u003c/code\u003e option 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--enable-failover\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEnables the slot to be synchronized to the standbys. This option may only be specified with \u003ccode\u003e--create-slot\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-f \u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--file=\u003cem\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWrite received and decoded transaction data into this file. Use \u003ccode\u003e-\u003c/code\u003e for \u003cspan\u003estdout\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003eThis parameter is required for \u003ccode\u003e--start\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-F \u003cem\u003e\u003ccode\u003einterval_seconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--fsync-interval=\u003cem\u003e\u003ccode\u003einterval_seconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies how often \u003cspan\u003epg_recvlogical\u003c/span\u003e should issue \u003ccode\u003efsync()\u003c/code\u003e calls to ensure the output file is safely flushed to disk.\u003c/p\u003e\n\u003cp\u003eThe 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.\u003c/p\u003e\n\u003cp\u003eSpecifying an interval of \u003ccode\u003e0\u003c/code\u003e disables issuing \u003ccode\u003efsync()\u003c/code\u003e calls altogether, while still reporting progress to the server. In this case, data could be lost in the event of a crash.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-I \u003cem\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--startpos=\u003cem\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIn \u003ccode\u003e--start\u003c/code\u003e mode, start replication from the given LSN. For details on the effect of this, see the documentation in \u003ca href=\"/docs/18/logicaldecoding.html\" rel=\"nofollow\"\u003eChapter 47\u003c/a\u003e and \u003ca href=\"/docs/18/protocol-replication.html\" rel=\"nofollow\"\u003eSection 54.4\u003c/a\u003e. Ignored in other modes.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e--if-not-exists\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not error out when \u003ccode\u003e--create-slot\u003c/code\u003e is specified and a slot with the specified name already exists.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-n\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-loop\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen the connection to the server is lost, do not retry in a loop, just exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-o \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e[=\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--option=\u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e[=\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePass the option \u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to the output plugin with, if specified, the option value \u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e. Which options exist and their effects depends on the used output plugin.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-P \u003cem\u003e\u003ccode\u003eplugin\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--plugin=\u003cem\u003e\u003ccode\u003eplugin\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen creating a slot, use the specified logical decoding output plugin. See \u003ca href=\"/docs/18/logicaldecoding.html\" rel=\"nofollow\"\u003eChapter 47\u003c/a\u003e. This option has no effect if the slot already exists.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-s \u003cem\u003e\u003ccode\u003einterval_seconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--status-interval=\u003cem\u003e\u003ccode\u003einterval_seconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option has the same effect as the option of the same name in \u003ca href=\"/docs/18/app-pgreceivewal.html\" title=\"pg_receivewal\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_receivewal\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. See the description there.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-S \u003cem\u003e\u003ccode\u003eslot_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--slot=\u003cem\u003e\u003ccode\u003eslot_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIn \u003ccode\u003e--start\u003c/code\u003e mode, use the existing logical replication slot named \u003cem\u003e\u003ccode\u003eslot_name\u003c/code\u003e\u003c/em\u003e. In \u003ccode\u003e--create-slot\u003c/code\u003e mode, create the slot with this name. In \u003ccode\u003e--drop-slot\u003c/code\u003e mode, delete the slot with this name.\u003c/p\u003e\n\u003cp\u003eThis parameter is required for any of actions.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-t\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--enable-two-phase\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--two-phase\u003c/code\u003e (deprecated)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEnables decoding of prepared transactions. This option may only be specified with \u003ccode\u003e--create-slot\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEnables verbose mode.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe following command-line options control the database connection parameters.\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-d \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--dbname=\u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe database to connect to. See the description of the actions for what this means in detail. The \u003cem\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" rel=\"nofollow\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003cp\u003eThis parameter is required for \u003ccode\u003e--create-slot\u003c/code\u003e and \u003ccode\u003e--start\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-h \u003cem\u003e\u003ccode\u003ehostname-or-ip\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--host=\u003cem\u003e\u003ccode\u003ehostname-or-ip\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies 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 \u003ccode\u003ePGHOST\u003c/code\u003e environment variable, if set, else a Unix domain socket connection is attempted.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-p \u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--port=\u003cem\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the \u003ccode\u003ePGPORT\u003c/code\u003e environment variable, if set, or a compiled-in default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-U \u003cem\u003e\u003ccode\u003euser\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--username=\u003cem\u003e\u003ccode\u003euser\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as. Defaults to current operating system user name.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan\u003epg_recvlogical\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan\u003epg_recvlogical\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan\u003epg_recvlogical\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe following additional options are available:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan\u003epg_recvlogical\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan\u003e\u003ccode\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan\u003epg_recvlogical\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.18.7\"\u003e\n\u003ch2\u003eExit Status\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003epg_recvlogical\u003c/span\u003e will exit with status 0 when terminated by the \u003cspan\u003eSIGINT\u003c/span\u003e or \u003cspan\u003eSIGTERM\u003c/span\u003e signal. (That is the normal way to end it. Hence it is not an error.) For fatal errors or other signals, the exit status will be nonzero.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.18.8\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cp\u003eThis utility, like most other \u003cspan\u003ePostgreSQL\u003c/span\u003e utilities, uses the environment variables supported by \u003cspan\u003elibpq\u003c/span\u003e (see \u003ca href=\"/docs/18/libpq-envars.html\" rel=\"nofollow\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eThe environment variable \u003ccode\u003ePG_COLOR\u003c/code\u003e specifies whether to use color in diagnostic messages. Possible values are \u003ccode\u003ealways\u003c/code\u003e, \u003ccode\u003eauto\u003c/code\u003e and \u003ccode\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.18.9\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003e\u003cspan\u003epg_recvlogical\u003c/span\u003e will preserve group permissions on the output files if group permissions are enabled on the source cluster.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.18.10\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eSee \u003ca href=\"/docs/18/logicaldecoding-example.html\" rel=\"nofollow\"\u003eSection 47.1\u003c/a\u003e for an example.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv id=\"id-1.9.4.18.11\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/docs/18/app-pgreceivewal.html\" title=\"pg_receivewal\" rel=\"nofollow\"\u003e\u003cspan\u003e\u003cspan\u003epg_receivewal\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","SourceRevision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8","ContentHash":"0a031c3f56bc12efaf47dc5e6e00f1650f8a4fc220ccee4d7f4ebab2182e31b0","Payload":{"description":["pg_recvlogical — control PostgreSQL logical decoding streams"],"manual_html":"\u003cdiv\u003e\u003cdiv class=\"refentry\" id=\"APP-PGRECVLOGICAL\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\u003c/div\u003e\n\u003cdiv class=\"refnamediv\"\u003e\n\u003ch2\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e\u003c/span\u003e\u003c/h2\u003e\n\u003cp\u003epg_recvlogical — control \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e logical decoding streams\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsynopsisdiv\"\u003e\n\u003ch2\u003eSynopsis\u003c/h2\u003e\n\u003cdiv class=\"cmdsynopsis\"\u003e\n\u003cp id=\"id-1.9.4.18.4.1\"\u003e\u003ccode class=\"command\"\u003epg_recvlogical\u003c/code\u003e [\u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e...]\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.5\"\u003e\n\u003ch2\u003eDescription\u003c/h2\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003epg_recvlogical\u003c/code\u003e controls logical decoding replication slots and streams data from such replication slots.\u003c/p\u003e\n\u003cp\u003eIt creates a replication-mode connection, so it is subject to the same constraints as \u003ca class=\"xref\" href=\"/docs/18/app-pgreceivewal.html\" title=\"pg_receivewal\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_receivewal\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e, plus those for logical replication (see \u003ca class=\"xref\" href=\"/docs/18/logicaldecoding.html\" title=\"Chapter 47. Logical Decoding\"\u003eChapter 47\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003epg_recvlogical\u003c/code\u003e 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 \u003ca class=\"link\" href=\"/docs/18/functions-admin.html#FUNCTIONS-REPLICATION\" title=\"9.28.6. Replication Management Functions\"\u003e\u003ccode class=\"function\"\u003epg_logical_slot_peek_changes\u003c/code\u003e\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eIn the absence of fatal errors, \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e will run until terminated by the \u003cspan class=\"systemitem\"\u003eSIGINT\u003c/span\u003e (\u003cspan class=\"keycap\"\u003e\u003cstrong\u003eControl\u003c/strong\u003e\u003c/span\u003e+\u003cspan class=\"keycap\"\u003e\u003cstrong\u003eC\u003c/strong\u003e\u003c/span\u003e) or \u003cspan class=\"systemitem\"\u003eSIGTERM\u003c/span\u003e signal.\u003c/p\u003e\n\u003cp\u003eWhen \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e receives a \u003cspan class=\"systemitem\"\u003eSIGHUP\u003c/span\u003e signal, it closes the current output file and opens a new one using the filename specified by the \u003ccode class=\"option\"\u003e--file\u003c/code\u003e option. This allows us to rotate the output file by first renaming the current file and then sending a \u003cspan class=\"systemitem\"\u003eSIGHUP\u003c/span\u003e signal to \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.6\"\u003e\n\u003ch2\u003eOptions\u003c/h2\u003e\n\u003cp\u003eAt least one of the following options must be specified to select an action:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eCreate a new logical replication slot with the name specified by \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e, using the output plugin specified by \u003ccode class=\"option\"\u003e--plugin\u003c/code\u003e, for the database specified by \u003ccode class=\"option\"\u003e--dbname\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e and \u003ccode class=\"option\"\u003e--dbname\u003c/code\u003e are required for this action.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--enable-two-phase\u003c/code\u003e and \u003ccode class=\"option\"\u003e--enable-failover\u003c/code\u003e options can be specified with \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--drop-slot\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDrop the replication slot with the name specified by \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e, then exit.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e is required for this action.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--start\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eBegin streaming changes from the logical replication slot specified by \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e, continuing until terminated by a signal. If the server side change stream ends with a server shutdown or disconnect, retry in a loop unless \u003ccode class=\"option\"\u003e--no-loop\u003c/code\u003e is specified.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e and \u003ccode class=\"option\"\u003e--dbname\u003c/code\u003e, \u003ccode class=\"option\"\u003e--file\u003c/code\u003e are required for this action.\u003c/p\u003e\n\u003cp\u003eThe stream format is determined by the output plugin specified when the slot was created.\u003c/p\u003e\n\u003cp\u003eThe connection must be to the same database used to create the slot.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e and \u003ccode class=\"option\"\u003e--start\u003c/code\u003e can be specified together. \u003ccode class=\"option\"\u003e--drop-slot\u003c/code\u003e cannot be combined with another action.\u003c/p\u003e\n\u003cp\u003eThe following command-line options control the location and format of the output and other replication behavior:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-E \u003cem class=\"replaceable\"\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--endpos=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIn \u003ccode class=\"option\"\u003e--start\u003c/code\u003e mode, automatically stop replication and exit with normal exit status 0 when receiving reaches the specified LSN. If specified when not in \u003ccode class=\"option\"\u003e--start\u003c/code\u003e mode, an error is raised.\u003c/p\u003e\n\u003cp\u003eIf there's a record with LSN exactly equal to \u003cem class=\"replaceable\"\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e, the record will be output.\u003c/p\u003e\n\u003cp\u003eThe \u003ccode class=\"option\"\u003e--endpos\u003c/code\u003e option 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.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--enable-failover\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEnables the slot to be synchronized to the standbys. This option may only be specified with \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-f \u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--file=\u003cem class=\"replaceable\"\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWrite received and decoded transaction data into this file. Use \u003ccode class=\"literal\"\u003e-\u003c/code\u003e for \u003cspan class=\"systemitem\"\u003estdout\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003eThis parameter is required for \u003ccode class=\"option\"\u003e--start\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-F \u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval_seconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--fsync-interval=\u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval_seconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies how often \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e should issue \u003ccode class=\"function\"\u003efsync()\u003c/code\u003e calls to ensure the output file is safely flushed to disk.\u003c/p\u003e\n\u003cp\u003eThe 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.\u003c/p\u003e\n\u003cp\u003eSpecifying an interval of \u003ccode class=\"literal\"\u003e0\u003c/code\u003e disables issuing \u003ccode class=\"function\"\u003efsync()\u003c/code\u003e calls altogether, while still reporting progress to the server. In this case, data could be lost in the event of a crash.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-I \u003cem class=\"replaceable\"\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--startpos=\u003cem class=\"replaceable\"\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIn \u003ccode class=\"option\"\u003e--start\u003c/code\u003e mode, start replication from the given LSN. For details on the effect of this, see the documentation in \u003ca class=\"xref\" href=\"/docs/18/logicaldecoding.html\" title=\"Chapter 47. Logical Decoding\"\u003eChapter 47\u003c/a\u003e and \u003ca class=\"xref\" href=\"/docs/18/protocol-replication.html\" title=\"54.4. Streaming Replication Protocol\"\u003eSection 54.4\u003c/a\u003e. Ignored in other modes.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--if-not-exists\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eDo not error out when \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e is specified and a slot with the specified name already exists.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-n\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-loop\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen the connection to the server is lost, do not retry in a loop, just exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-o \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e[=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--option=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e[=\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e]\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePass the option \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e to the output plugin with, if specified, the option value \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e. Which options exist and their effects depends on the used output plugin.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-P \u003cem class=\"replaceable\"\u003e\u003ccode\u003eplugin\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--plugin=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eplugin\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eWhen creating a slot, use the specified logical decoding output plugin. See \u003ca class=\"xref\" href=\"/docs/18/logicaldecoding.html\" title=\"Chapter 47. Logical Decoding\"\u003eChapter 47\u003c/a\u003e. This option has no effect if the slot already exists.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-s \u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval_seconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--status-interval=\u003cem class=\"replaceable\"\u003e\u003ccode\u003einterval_seconds\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis option has the same effect as the option of the same name in \u003ca class=\"xref\" href=\"/docs/18/app-pgreceivewal.html\" title=\"pg_receivewal\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_receivewal\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e. See the description there.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-S \u003cem class=\"replaceable\"\u003e\u003ccode\u003eslot_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--slot=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eslot_name\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eIn \u003ccode class=\"option\"\u003e--start\u003c/code\u003e mode, use the existing logical replication slot named \u003cem class=\"replaceable\"\u003e\u003ccode\u003eslot_name\u003c/code\u003e\u003c/em\u003e. In \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e mode, create the slot with this name. In \u003ccode class=\"option\"\u003e--drop-slot\u003c/code\u003e mode, delete the slot with this name.\u003c/p\u003e\n\u003cp\u003eThis parameter is required for any of actions.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-t\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--enable-two-phase\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--two-phase\u003c/code\u003e (deprecated)\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEnables decoding of prepared transactions. This option may only be specified with \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-v\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--verbose\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eEnables verbose mode.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe following command-line options control the database connection parameters.\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-d \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--dbname=\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThe database to connect to. See the description of the actions for what this means in detail. The \u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e can be a \u003ca class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1. Connection Strings\"\u003econnection string\u003c/a\u003e. If so, connection string parameters will override any conflicting command line options.\u003c/p\u003e\n\u003cp\u003eThis parameter is required for \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e and \u003ccode class=\"option\"\u003e--start\u003c/code\u003e.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-h \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname-or-ip\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--host=\u003cem class=\"replaceable\"\u003e\u003ccode\u003ehostname-or-ip\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies 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 \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e environment variable, if set, else a Unix domain socket connection is attempted.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-p \u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--port=\u003cem class=\"replaceable\"\u003e\u003ccode\u003eport\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e environment variable, if set, or a compiled-in default.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-U \u003cem class=\"replaceable\"\u003e\u003ccode\u003euser\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--username=\u003cem class=\"replaceable\"\u003e\u003ccode\u003euser\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eUser name to connect as. Defaults to current operating system user name.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-w\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--no-password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eNever issue a password prompt. If the server requires password authentication and a password is not available by other means such as a \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-W\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--password\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eForce \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e to prompt for a password before connecting to a database.\u003c/p\u003e\n\u003cp\u003eThis option is never essential, since \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e will automatically prompt for a password if the server demands password authentication. However, \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing \u003ccode class=\"option\"\u003e-W\u003c/code\u003e to avoid the extra connection attempt.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eThe following additional options are available:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-V\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--version\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003ePrint the \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e version and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e-?\u003c/code\u003e\u003cbr\u003e\u003c/span\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--help\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eShow help about \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e command line arguments, and exit.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.7\"\u003e\n\u003ch2\u003eExit Status\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e will exit with status 0 when terminated by the \u003cspan class=\"systemitem\"\u003eSIGINT\u003c/span\u003e or \u003cspan class=\"systemitem\"\u003eSIGTERM\u003c/span\u003e signal. (That is the normal way to end it. Hence it is not an error.) For fatal errors or other signals, the exit status will be nonzero.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.8\"\u003e\n\u003ch2\u003eEnvironment\u003c/h2\u003e\n\u003cp\u003eThis utility, like most other \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e utilities, uses the environment variables supported by \u003cspan class=\"application\"\u003elibpq\u003c/span\u003e (see \u003ca class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15. Environment Variables\"\u003eSection 32.15\u003c/a\u003e).\u003c/p\u003e\n\u003cp\u003eThe environment variable \u003ccode class=\"envar\"\u003ePG_COLOR\u003c/code\u003e specifies whether to use color in diagnostic messages. Possible values are \u003ccode class=\"literal\"\u003ealways\u003c/code\u003e, \u003ccode class=\"literal\"\u003eauto\u003c/code\u003e and \u003ccode class=\"literal\"\u003enever\u003c/code\u003e.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.9\"\u003e\n\u003ch2\u003eNotes\u003c/h2\u003e\n\u003cp\u003e\u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e will preserve group permissions on the output files if group permissions are enabled on the source cluster.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.10\"\u003e\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eSee \u003ca class=\"xref\" href=\"/docs/18/logicaldecoding-example.html\" title=\"47.1. Logical Decoding Examples\"\u003eSection 47.1\u003c/a\u003e for an example.\u003c/p\u003e\n\u003c/div\u003e\n\u003cdiv class=\"refsect1\" id=\"id-1.9.4.18.11\"\u003e\n\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/docs/18/app-pgreceivewal.html\" title=\"pg_receivewal\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_receivewal\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003c/div\u003e","related":[{"label":"libpq connection parameters","url":"/wiki/conn/?v=18"}],"sections":[],"tables":[{"columns":[{"key":"signature","label":"Option and arguments"},{"key":"summary","label":"Description"}],"key":"options","rows":[{"signature":{"text":"--create-slot","url":"/docs/18/app-pgrecvlogical.html"},"summary":"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 ."},{"signature":{"text":"--drop-slot","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Drop the replication slot with the name specified by --slot , then exit."},{"signature":{"text":"--start","url":"/docs/18/app-pgrecvlogical.html"},"summary":"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-loop is specified."},{"signature":{"text":"-E lsn --endpos= lsn","url":"/docs/18/app-pgrecvlogical.html"},"summary":"In --start mode, automatically stop replication and exit with normal exit status 0 when receiving reaches the specified LSN. If specified when not in --start mode, an error is raised."},{"signature":{"text":"--enable-failover","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Enables the slot to be synchronized to the standbys. This option may only be specified with --create-slot ."},{"signature":{"text":"-f filename --file= filename","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Write received and decoded transaction data into this file. Use - for stdout ."},{"signature":{"text":"-F interval_seconds --fsync-interval= interval_seconds","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Specifies how often pg_recvlogical should issue fsync() calls to ensure the output file is safely flushed to disk."},{"signature":{"text":"-I lsn --startpos= lsn","url":"/docs/18/app-pgrecvlogical.html"},"summary":"In --start mode, start replication from the given LSN. For details on the effect of this, see the documentation in Chapter 47 and Section 54.4 . Ignored in other modes."},{"signature":{"text":"--if-not-exists","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Do not error out when --create-slot is specified and a slot with the specified name already exists."},{"signature":{"text":"-n --no-loop","url":"/docs/18/app-pgrecvlogical.html"},"summary":"When the connection to the server is lost, do not retry in a loop, just exit."},{"signature":{"text":"-o name [= value ] --option= name [= value ]","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Pass the option name to the output plugin with, if specified, the option value value . Which options exist and their effects depends on the used output plugin."},{"signature":{"text":"-P plugin --plugin= plugin","url":"/docs/18/app-pgrecvlogical.html"},"summary":"When creating a slot, use the specified logical decoding output plugin. See Chapter 47 . This option has no effect if the slot already exists."},{"signature":{"text":"-s interval_seconds --status-interval= interval_seconds","url":"/docs/18/app-pgrecvlogical.html"},"summary":"This option has the same effect as the option of the same name in pg_receivewal . See the description there."},{"signature":{"text":"-S slot_name --slot= slot_name","url":"/docs/18/app-pgrecvlogical.html"},"summary":"In --start mode, use the existing logical replication slot named slot_name . In --create-slot mode, create the slot with this name. In --drop-slot mode, delete the slot with this name."},{"signature":{"text":"-t --enable-two-phase --two-phase (deprecated)","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Enables decoding of prepared transactions. This option may only be specified with --create-slot ."},{"signature":{"text":"-v --verbose","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Enables verbose mode."},{"signature":{"text":"-d dbname --dbname= dbname","url":"/docs/18/app-pgrecvlogical.html"},"summary":"The database to connect to. See the description of the actions for what this means in detail. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."},{"signature":{"text":"-h hostname-or-ip --host= hostname-or-ip","url":"/docs/18/app-pgrecvlogical.html"},"summary":"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 PGHOST environment variable, if set, else a Unix domain socket connection is attempted."},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default."},{"signature":{"text":"-U user --username= user","url":"/docs/18/app-pgrecvlogical.html"},"summary":"User name to connect as. Defaults to current operating system user name."},{"signature":{"text":"-w --no-password","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password."},{"signature":{"text":"-W --password","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Force pg_recvlogical to prompt for a password before connecting to a database."},{"signature":{"text":"-V --version","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Print the pg_recvlogical version and exit."},{"signature":{"text":"-? --help","url":"/docs/18/app-pgrecvlogical.html"},"summary":"Show help about pg_recvlogical command line arguments, and exit."}],"title":"Documented options"}]}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
