{"Entry":{"collection":"tool","key":"pg-recvlogical","name":"pg_recvlogical","aliases":["pg_recvlogical"],"metadata":{"aliases":["pg_recvlogical"],"category":"Client applications","content_hash":"6e51b4b791bf62502d105ef2553c57a513e6bc34c4a42b7a45b82dc8611d1672","derived_content_hash":"3c4b88d372fdb51422beeef850f98b04bb60d4907187322d390e97f037f864ff","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"],"description_zh":"描述 pg_recvlogical 用于控制逻辑解码复制槽，并从这类复制槽流式传输数据。 它会创建复制模式连接，因此除受到与 pg_receivewal 相同的约束外，还要满足逻辑复制的相关约束（见 第 47 章 ）。 pg_recvlogical 没有与逻辑解码 SQL 接口中 peek 和 get 模式等价的功能。它会在接收数据期间惰性地为这些数据发送重放确认，并在正常退出时发送确认。若要在不消费数据的情况下检查某个槽上的待处理数据，请使用 pg_logical_slot_peek_changes 。 在没有致命错误的情况下， pg_recvlogical 会一直运行，直到收到 SIGINT （ Control + C ）或 SIGTERM 信号。 当 pg_recvlogical 收到 SIGHUP 信号时，它会关闭当前输出文件，并使用 --file 选项指定的文件名打开一个新文件。这样就可以通过先重命名当前文件，再向 pg_recvlogical 发送 SIGHUP 信号来轮换输出文件。 选项 至少必须指定以下选项之一，以选择要执行的操作： --create-slot 为由 --dbname 指定的数据库，使用 --plugin 指定的输出插件，创建一个名称由 --slot 指定的新逻辑复制槽。 此操作必须指定 --slot 和 --dbname 。 可与 --create-slot 一起指定 --enable-two-phase 和 --enable-failover 选项。 --drop-slot 删除由 --slot 指定名称的复制槽，然后退出。 此操作必须指定 --slot 。 --start 开始从由 --slot 指定的逻辑复制槽流式传输更改，并持续运行直到被信号终止。如果服务端的更改流因服务器关闭或断开连接而结束，则除非指定了 --no-loop ，否则会循环重试。 此操作必须指定 --slot 、 --dbname 和 --file 。 流格式由创建该槽时指定的输出插件决定。 该连接必须连到创建该槽时所用的同一个数据库。 --create-slo","description_zh_html":"\u003cp\u003e命令行工具 pg_recvlogical [ option ...]。\u003c/p\u003e\u003ch3\u003e同版本中文手册节选\u003c/h3\u003e\u003cdiv class=\"refsect1\"\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003epg_recvlogical\u003c/code\u003e 用于控制逻辑解码复制槽，并从这类复制槽流式传输数据。\n  \u003c/p\u003e\u003cp\u003e\n   它会创建复制模式连接，因此除受到与 \u003ca class=\"xref\" href=\"/zh/docs/18/app-pgreceivewal.html\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_receivewal\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e 相同的约束外，还要满足逻辑复制的相关约束（见\u003ca class=\"xref\" href=\"/zh/docs/18/logicaldecoding.html\"\u003e第 47 章\u003c/a\u003e）。\n  \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003epg_recvlogical\u003c/code\u003e 没有与逻辑解码 SQL 接口中 peek 和 get 模式等价的功能。它会在接收数据期间惰性地为这些数据发送重放确认，并在正常退出时发送确认。若要在不消费数据的情况下检查某个槽上的待处理数据，请使用 \u003ca class=\"link\" href=\"/zh/docs/18/functions-admin.html#FUNCTIONS-REPLICATION\"\u003e\u003ccode class=\"function\"\u003epg_logical_slot_peek_changes\u003c/code\u003e\u003c/a\u003e。\n  \u003c/p\u003e\u003cp\u003e\n   在没有致命错误的情况下，\u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e 会一直运行，直到收到\n   \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）或 \u003cspan class=\"systemitem\"\u003eSIGTERM\u003c/span\u003e 信号。\n  \u003c/p\u003e\u003cp\u003e\n   当 \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e 收到 \u003cspan class=\"systemitem\"\u003eSIGHUP\u003c/span\u003e 信号时，它会关闭当前输出文件，并使用 \u003ccode class=\"option\"\u003e--file\u003c/code\u003e 选项指定的文件名打开一个新文件。这样就可以通过先重命名当前文件，再向 \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e 发送\n   \u003cspan class=\"systemitem\"\u003eSIGHUP\u003c/span\u003e 信号来轮换输出文件。\n  \u003c/p\u003e\u003c/div\u003e\u003cdiv class=\"refsect1\"\u003e\u003ch2\u003e选项\u003c/h2\u003e\u003cp\u003e\n    至少必须指定以下选项之一，以选择要执行的操作：\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        为由 \u003ccode class=\"option\"\u003e--dbname\u003c/code\u003e 指定的数据库，使用 \u003ccode class=\"option\"\u003e--plugin\u003c/code\u003e 指定的输出插件，创建一个名称由 \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e 指定的新逻辑复制槽。\n       \u003c/p\u003e\u003cp\u003e\n        此操作必须指定 \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e 和 \u003ccode class=\"option\"\u003e--dbname\u003c/code\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        可与 \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e 一起指定 \u003ccode class=\"option\"\u003e--enable-two-phase\u003c/code\u003e 和 \u003ccode class=\"option\"\u003e--enable-failover\u003c/code\u003e 选项。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--drop-slot\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        删除由 \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e 指定名称的复制槽，然后退出。\n       \u003c/p\u003e\u003cp\u003e\n        此操作必须指定 \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--start\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        开始从由 \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e 指定的逻辑复制槽流式传输更改，并持续运行直到被信号终止。如果服务端的更改流因服务器关闭或断开连接而结束，则除非指定了 \u003ccode class=\"option\"\u003e--no-loop\u003c/code\u003e，否则会循环重试。\n       \u003c/p\u003e\u003cp\u003e\n        此操作必须指定 \u003ccode class=\"option\"\u003e--slot\u003c/code\u003e、\u003ccode class=\"option\"\u003e--dbname\u003c/code\u003e 和 \u003ccode class=\"option\"\u003e--file\u003c/code\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        流格式由创建该槽时指定的输出插件决定。\n       \u003c/p\u003e\u003cp\u003e\n        该连接必须连到创建该槽时所用的同一个数据库。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e 和 \u003ccode class=\"option\"\u003e--start\u003c/code\u003e 可以一同指定。\u003ccode class=\"option\"\u003e--drop-slot\u003c/code\u003e 不能与其他操作组合使用。\n   \u003c/p\u003e\u003cp\u003e\n    以下命令行选项控制输出的位置和格式以及其他复制行为：\n\n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\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\u003cdd\u003e\u003cp\u003e\n        在 \u003ccode class=\"option\"\u003e--start\u003c/code\u003e 模式下，当接收达到指定的 LSN 时，自动停止复制，并以正常退出状态 0 退出。如果在非 \u003ccode class=\"option\"\u003e--start\u003c/code\u003e 模式下指定，则会报错。\n       \u003c/p\u003e\u003cp\u003e\n        如果存在 LSN 恰好等于 \u003cem class=\"replaceable\"\u003e\u003ccode\u003elsn\u003c/code\u003e\u003c/em\u003e 的记录，则该记录会被输出。\n       \u003c/p\u003e\u003cp\u003e\n\u003ccode class=\"option\"\u003e--endpos\u003c/code\u003e 选项不会感知事务边界，因此可能会在事务中途截断输出。任何只输出了一部分的事务都不会被消费，并会在下次从该槽读取时再次重放。单条消息永远不会被截断。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--enable-failover\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        允许将该槽同步到备库。此选项只能与 \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e 一起指定。\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        将接收到并解码后的事务数据写入该文件。指定\u003ccode class=\"literal\"\u003e-\u003c/code\u003e表示写入 \u003cspan class=\"systemitem\"\u003estdout\u003c/span\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        此参数对于 \u003ccode class=\"option\"\u003e--start\u003c/code\u003e 操作是必需的。\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        指定 \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e 应当以多高的频率发起 \u003ccode class=\"function\"\u003efsync()\u003c/code\u003e 调用，以确保输出文件安全刷盘。\n       \u003c/p\u003e\u003cp\u003e\n        服务器会偶尔要求客户端执行刷盘，并将刷盘位置报告给服务器。除此之外，此设置还会更频繁地执行刷盘。\n       \u003c/p\u003e\u003cp\u003e\n        将间隔指定为 \u003ccode class=\"literal\"\u003e0\u003c/code\u003e 会完全禁用 \u003ccode class=\"function\"\u003efsync()\u003c/code\u003e 调用，但仍会向服务器报告进度。在这种情况下，发生崩溃时可能会丢失数据。\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        在 \u003ccode class=\"option\"\u003e--start\u003c/code\u003e 模式下，从给定的 LSN 开始复制。关于其影响的详细信息，请参见\u003ca class=\"xref\" href=\"/zh/docs/18/logicaldecoding.html\"\u003e第 47 章\u003c/a\u003e和\u003ca class=\"xref\" href=\"/zh/docs/18/protocol-replication.html\"\u003e第 54.4 节\u003c/a\u003e中的说明。在其他模式下会忽略此选项。\n       \u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"option\"\u003e--if-not-exists\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        当指定 \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e 且指定名称的槽已存在时，不报错。\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        当与服务器的连接丢失时，不要循环重试，直接退出。\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        将选项 \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e 传递给输出插件；如果指定了 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e，则将其用作该选项的值。可用选项及其效果取决于所使用的输出插件。\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        创建该槽时，使用指定的逻辑解码输出插件。参见\u003ca class=\"xref\" href=\"/zh/docs/18/logicaldecoding.html\"\u003e第 47 章\u003c/a\u003e。如果该槽已经存在，则此选项不起作用。\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        该选项与 \u003ca class=\"xref\" href=\"/zh/docs/18/app-pgreceivewal.html\"\u003e\u003cspan class=\"refentrytitle\"\u003e\u003cspan class=\"application\"\u003epg_receivewal\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e 中同名选项的效果相同。参见该处说明。\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        在 \u003ccode class=\"option\"\u003e--start\u003c/code\u003e 模式下，使用名为 \u003cem class=\"replaceable\"\u003e\u003ccode\u003eslot_name\u003c/code\u003e\u003c/em\u003e 的现有逻辑复制槽。在 \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e 模式下，以此名称创建该槽。在 \u003ccode class=\"option\"\u003e--drop-slot\u003c/code\u003e 模式下，删除此名称的槽。\n       \u003c/p\u003e\u003cp\u003e\n        此参数对于任何一种操作都是必需的。\n       \u003c/p\u003e\u003c/dd\u003e\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（已废弃）\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n        启用对预备事务的解码。此选项只能与 \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e 一起指定。\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n        启用详细模式。\n       \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    下列命令行选项控制数据库连接参数。\n \n    \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\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\u003cdd\u003e\u003cp\u003e\n         要连接到的数据库。其具体含义请参见各操作的说明。\u003cem class=\"replaceable\"\u003e\u003ccode\u003edbname\u003c/code\u003e\u003c/em\u003e 可以是一个\u003ca class=\"link\" href=\"/zh/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\"\u003e连接字符串\u003c/a\u003e。如果是这种情况，连接字符串参数将覆盖任何冲突的命令行选项。\n        \u003c/p\u003e\u003cp\u003e\n         此参数在 \u003ccode class=\"option\"\u003e--create-slot\u003c/code\u003e 和 \u003ccode class=\"option\"\u003e--start\u003c/code\u003e 操作中是必需的。\n        \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n         指定服务器运行所在机器的主机名。如果该值以斜杠开头，则它会被用作 Unix 域套接字的目录。默认值取自\n         \u003ccode class=\"envar\"\u003ePGHOST\u003c/code\u003e 环境变量（如果已设置），否则将尝试 Unix 域套接字连接。\n        \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n         指定服务器监听连接所用的 TCP 端口，或本地 Unix 域套接字文件扩展名。默认值取自 \u003ccode class=\"envar\"\u003ePGPORT\u003c/code\u003e 环境变量（如果已设置），否则使用编译时的默认值。\n        \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n         用于连接的用户名。默认为当前操作系统用户名。\n        \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n         绝不提示输入密码。如果服务器要求密码认证，而密码又无法通过\n         \u003ccode class=\"filename\"\u003e.pgpass\u003c/code\u003e 文件等其他方式获得，则连接尝试将失败。此选项适用于批处理作业和脚本，因为在这些场景中没有用户在场输入密码。\n        \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n         强制 \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e 在连接数据库之前提示输入密码。\n        \u003c/p\u003e\u003cp\u003e\n         这个选项并非必不可少，因为如果服务器要求密码认证，\u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e 会自动提示输入密码。不过，\u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e 需要先浪费一次连接尝试，才能发现服务器需要密码。在某些情况下，使用\n         \u003ccode class=\"option\"\u003e-W\u003c/code\u003e 来避免这次额外的连接尝试是值得的。\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n    还可以使用下列附加选项：\n\n   \u003c/p\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\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\u003cdd\u003e\u003cp\u003e\n        打印 \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e 的版本并退出。\n       \u003c/p\u003e\u003c/dd\u003e\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\u003cdd\u003e\u003cp\u003e\n         显示 \u003cspan class=\"application\"\u003epg_recvlogical\u003c/span\u003e 命令行参数的帮助并退出。\n        \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003cp\u003e\n\u003c/p\u003e\u003c/div\u003e\u003cp\u003e\u003ca href=\"/zh/docs/18/app-pgrecvlogical.html\"\u003e查看完整中文手册与上下文\u003c/a\u003e。\u003c/p\u003e","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"}],"facts_zh":[{"label":"手册中的可执行程序","value":"pg_recvlogical"},{"label":"程序版本","value":"18.6"},{"label":"参考清单","value":"客户端程序"},{"label":"选项定义组","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":[],"sections_zh":[],"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"}],"tables_zh":[{"columns":[{"key":"signature","label":"选项与参数"},{"key":"summary","label":"说明"}],"key":"options","rows":[{"signature":{"text":"--create-slot","url":"/docs/18/app-pgrecvlogical.html"},"summary":"为 --dbname 指定的数据库创建新的逻辑复制槽，名称由 --slot 指定，输出插件由 --plugin 指定。"},{"signature":{"text":"--drop-slot","url":"/docs/18/app-pgrecvlogical.html"},"summary":"删除由 --slot 指定名称的复制槽，然后退出。"},{"signature":{"text":"--start","url":"/docs/18/app-pgrecvlogical.html"},"summary":"开始从由 --slot 指定的逻辑复制槽流式传输更改，并持续运行直到被信号终止。如果服务端的更改流因服务器关闭或断开连接而结束，则除非指定了 --no-loop ，否则会循环重试。"},{"signature":{"text":"-E lsn --endpos= lsn","url":"/docs/18/app-pgrecvlogical.html"},"summary":"在 --start 模式下，当接收达到指定的 LSN 时，自动停止复制，并以正常退出状态 0 退出。如果在非 --start 模式下指定，则会报错。"},{"signature":{"text":"--enable-failover","url":"/docs/18/app-pgrecvlogical.html"},"summary":"允许将该槽同步到备库。此选项只能与 --create-slot 一起指定。"},{"signature":{"text":"-f filename --file= filename","url":"/docs/18/app-pgrecvlogical.html"},"summary":"将接收到并解码后的事务数据写入该文件。指定 - 表示写入 stdout 。"},{"signature":{"text":"-F interval_seconds --fsync-interval= interval_seconds","url":"/docs/18/app-pgrecvlogical.html"},"summary":"指定 pg_recvlogical 应当以多高的频率发起 fsync() 调用，以确保输出文件安全刷盘。"},{"signature":{"text":"-I lsn --startpos= lsn","url":"/docs/18/app-pgrecvlogical.html"},"summary":"在 --start 模式下，从给定的 LSN 开始复制。关于其影响的详细信息，请参见 第 47 章 和 第 54.4 节 中的说明。在其他模式下会忽略此选项。"},{"signature":{"text":"--if-not-exists","url":"/docs/18/app-pgrecvlogical.html"},"summary":"当指定 --create-slot 且指定名称的槽已存在时，不报错。"},{"signature":{"text":"-n --no-loop","url":"/docs/18/app-pgrecvlogical.html"},"summary":"当与服务器的连接丢失时，不要循环重试，直接退出。"},{"signature":{"text":"-o name [= value ] --option= name [= value ]","url":"/docs/18/app-pgrecvlogical.html"},"summary":"将选项 name 传递给输出插件；如果指定了 value ，则将其用作该选项的值。可用选项及其效果取决于所使用的输出插件。"},{"signature":{"text":"-P plugin --plugin= plugin","url":"/docs/18/app-pgrecvlogical.html"},"summary":"创建该槽时，使用指定的逻辑解码输出插件。参见 第 47 章 。如果该槽已经存在，则此选项不起作用。"},{"signature":{"text":"-s interval_seconds --status-interval= interval_seconds","url":"/docs/18/app-pgrecvlogical.html"},"summary":"该选项与 pg_receivewal 中同名选项的效果相同。参见该处说明。"},{"signature":{"text":"-S slot_name --slot= slot_name","url":"/docs/18/app-pgrecvlogical.html"},"summary":"在 --start 模式下，使用名为 slot_name 的现有逻辑复制槽。在 --create-slot 模式下，以此名称创建该槽。在 --drop-slot 模式下，删除此名称的槽。"},{"signature":{"text":"-t --enable-two-phase --two-phase (deprecated)","url":"/docs/18/app-pgrecvlogical.html"},"summary":"启用对预备事务的解码。此选项只能与 --create-slot 一起指定。"},{"signature":{"text":"-v --verbose","url":"/docs/18/app-pgrecvlogical.html"},"summary":"启用详细模式。"},{"signature":{"text":"-d dbname --dbname= dbname","url":"/docs/18/app-pgrecvlogical.html"},"summary":"要连接到的数据库。其具体含义请参见各操作的说明。 dbname 可以是一个 连接字符串 。如果是这种情况，连接字符串参数将覆盖任何冲突的命令行选项。"},{"signature":{"text":"-h hostname-or-ip --host= hostname-or-ip","url":"/docs/18/app-pgrecvlogical.html"},"summary":"指定服务器运行所在机器的主机名。如果该值以斜杠开头，则它会被用作 Unix 域套接字的目录。默认值取自 PGHOST 环境变量（如果已设置），否则将尝试 Unix 域套接字连接。"},{"signature":{"text":"-p port --port= port","url":"/docs/18/app-pgrecvlogical.html"},"summary":"指定服务器监听连接所用的 TCP 端口，或本地 Unix 域套接字文件扩展名。默认值取自 PGPORT 环境变量（如果已设置），否则使用编译时的默认值。"},{"signature":{"text":"-U user --username= user","url":"/docs/18/app-pgrecvlogical.html"},"summary":"用于连接的用户名。默认为当前操作系统用户名。"},{"signature":{"text":"-w --no-password","url":"/docs/18/app-pgrecvlogical.html"},"summary":"绝不提示输入密码。如果服务器要求密码认证，而密码又无法通过 .pgpass 文件等其他方式获得，则连接尝试将失败。此选项适用于批处理作业和脚本，因为在这些场景中没有用户在场输入密码。"},{"signature":{"text":"-W --password","url":"/docs/18/app-pgrecvlogical.html"},"summary":"强制 pg_recvlogical 在连接数据库之前提示输入密码。"},{"signature":{"text":"-V --version","url":"/docs/18/app-pgrecvlogical.html"},"summary":"打印 pg_recvlogical 的版本并退出。"},{"signature":{"text":"-? --help","url":"/docs/18/app-pgrecvlogical.html"},"summary":"显示 pg_recvlogical 命令行参数的帮助并退出。"}],"title":"手册中的选项"}],"zh_from":{"authored_translation":"source-derived-identity","body_sha256":"74b4d9a972036f1c5c30ef6112411bdd66e10586596c0631a6bb6f4153056b96","kind":"same-version-chinese-manual-with-source-derived-identity","manual":{"anchor":"","build_id":107,"extraction":"command-description-and-options","fragment_sha256":"3fb41a031c9a862e8bd116321197f6ab23d58ce40312dbe1a44876a763ca791b","locale":"zh-Hans","page_key":"app-pgrecvlogical.html","source_hash":"971f3f1ddbccf288b9e0486341ee97a572305bdf80980c3dc40cee36022990c4","source_revision":"unknown:rendered-translation-baseline","translated_from_revision":null,"translation_revision":"git:b1b500221dbe5437cfca004d6b04d3f6e422765d;html-sha256:08e987a66af27b98444a8057c256314eafa13611a3fb9e888214fc436824244b","url":"/zh/docs/18/app-pgrecvlogical.html","version":"18"},"runtime_rerun":false,"source_facts_revision":"ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8"}},"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":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
