1PG_RECVLOGICAL(1)        PostgreSQL 16.1 Documentation       PG_RECVLOGICAL(1)
2
3
4

NAME

6       pg_recvlogical - control PostgreSQL logical decoding streams
7

SYNOPSIS

9       pg_recvlogical [option...]
10

DESCRIPTION

12       pg_recvlogical controls logical decoding replication slots and streams
13       data from such replication slots.
14
15       It creates a replication-mode connection, so it is subject to the same
16       constraints as pg_receivewal(1), plus those for logical replication
17       (see Chapter 49).
18
19       pg_recvlogical has no equivalent to the logical decoding SQL
20       interface's peek and get modes. It sends replay confirmations for data
21       lazily as it receives it and on clean exit. To examine pending data on
22       a slot without consuming it, use pg_logical_slot_peek_changes.
23
24       In the absence of fatal errors, pg_recvlogical will run until
25       terminated by the SIGINT (Control+C) or SIGTERM signal.
26

OPTIONS

28       At least one of the following options must be specified to select an
29       action:
30
31       --create-slot
32           Create a new logical replication slot with the name specified by
33           --slot, using the output plugin specified by --plugin, for the
34           database specified by --dbname.
35
36           The --two-phase can be specified with --create-slot to enable
37           decoding of prepared transactions.
38
39       --drop-slot
40           Drop the replication slot with the name specified by --slot, then
41           exit.
42
43       --start
44           Begin streaming changes from the logical replication slot specified
45           by --slot, continuing until terminated by a signal. If the server
46           side change stream ends with a server shutdown or disconnect, retry
47           in a loop unless --no-loop is specified.
48
49           The stream format is determined by the output plugin specified when
50           the slot was created.
51
52           The connection must be to the same database used to create the
53           slot.
54
55       --create-slot and --start can be specified together.  --drop-slot
56       cannot be combined with another action.
57
58       The following command-line options control the location and format of
59       the output and other replication behavior:
60
61       -E lsn
62       --endpos=lsn
63           In --start mode, automatically stop replication and exit with
64           normal exit status 0 when receiving reaches the specified LSN. If
65           specified when not in --start mode, an error is raised.
66
67           If there's a record with LSN exactly equal to lsn, the record will
68           be output.
69
70           The --endpos option is not aware of transaction boundaries and may
71           truncate output partway through a transaction. Any partially output
72           transaction will not be consumed and will be replayed again when
73           the slot is next read from. Individual messages are never
74           truncated.
75
76       -f filename
77       --file=filename
78           Write received and decoded transaction data into this file. Use -
79           for stdout.
80
81       -F interval_seconds
82       --fsync-interval=interval_seconds
83           Specifies how often pg_recvlogical should issue fsync() calls to
84           ensure the output file is safely flushed to disk.
85
86           The server will occasionally request the client to perform a flush
87           and report the flush position to the server. This setting is in
88           addition to that, to perform flushes more frequently.
89
90           Specifying an interval of 0 disables issuing fsync() calls
91           altogether, while still reporting progress to the server. In this
92           case, data could be lost in the event of a crash.
93
94       -I lsn
95       --startpos=lsn
96           In --start mode, start replication from the given LSN. For details
97           on the effect of this, see the documentation in Chapter 49 and
98           Section 55.4. Ignored in other modes.
99
100       --if-not-exists
101           Do not error out when --create-slot is specified and a slot with
102           the specified name already exists.
103
104       -n
105       --no-loop
106           When the connection to the server is lost, do not retry in a loop,
107           just exit.
108
109       -o name[=value]
110       --option=name[=value]
111           Pass the option name to the output plugin with, if specified, the
112           option value value. Which options exist and their effects depends
113           on the used output plugin.
114
115       -P plugin
116       --plugin=plugin
117           When creating a slot, use the specified logical decoding output
118           plugin. See Chapter 49. This option has no effect if the slot
119           already exists.
120
121       -s interval_seconds
122       --status-interval=interval_seconds
123           This option has the same effect as the option of the same name in
124           pg_receivewal(1). See the description there.
125
126       -S slot_name
127       --slot=slot_name
128           In --start mode, use the existing logical replication slot named
129           slot_name. In --create-slot mode, create the slot with this name.
130           In --drop-slot mode, delete the slot with this name.
131
132       -t
133       --two-phase
134           Enables decoding of prepared transactions. This option may only be
135           specified with --create-slot
136
137       -v
138       --verbose
139           Enables verbose mode.
140
141       The following command-line options control the database connection
142       parameters.
143
144       -d dbname
145       --dbname=dbname
146           The database to connect to. See the description of the actions for
147           what this means in detail. The dbname can be a connection string.
148           If so, connection string parameters will override any conflicting
149           command line options. Defaults to the user name.
150
151       -h hostname-or-ip
152       --host=hostname-or-ip
153           Specifies the host name of the machine on which the server is
154           running. If the value begins with a slash, it is used as the
155           directory for the Unix domain socket. The default is taken from the
156           PGHOST environment variable, if set, else a Unix domain socket
157           connection is attempted.
158
159       -p port
160       --port=port
161           Specifies the TCP port or local Unix domain socket file extension
162           on which the server is listening for connections. Defaults to the
163           PGPORT environment variable, if set, or a compiled-in default.
164
165       -U user
166       --username=user
167           User name to connect as. Defaults to current operating system user
168           name.
169
170       -w
171       --no-password
172           Never issue a password prompt. If the server requires password
173           authentication and a password is not available by other means such
174           as a .pgpass file, the connection attempt will fail. This option
175           can be useful in batch jobs and scripts where no user is present to
176           enter a password.
177
178       -W
179       --password
180           Force pg_recvlogical to prompt for a password before connecting to
181           a database.
182
183           This option is never essential, since pg_recvlogical will
184           automatically prompt for a password if the server demands password
185           authentication. However, pg_recvlogical will waste a connection
186           attempt finding out that the server wants a password. In some cases
187           it is worth typing -W to avoid the extra connection attempt.
188
189       The following additional options are available:
190
191       -V
192       --version
193           Print the pg_recvlogical version and exit.
194
195       -?
196       --help
197           Show help about pg_recvlogical command line arguments, and exit.
198

EXIT STATUS

200       pg_recvlogical will exit with status 0 when terminated by the SIGINT or
201       SIGTERM signal. (That is the normal way to end it. Hence it is not an
202       error.) For fatal errors or other signals, the exit status will be
203       nonzero.
204

ENVIRONMENT

206       This utility, like most other PostgreSQL utilities, uses the
207       environment variables supported by libpq (see Section 34.15).
208
209       The environment variable PG_COLOR specifies whether to use color in
210       diagnostic messages. Possible values are always, auto and never.
211

NOTES

213       pg_recvlogical will preserve group permissions on the received WAL
214       files if group permissions are enabled on the source cluster.
215

EXAMPLES

217       See Section 49.1 for an example.
218

SEE ALSO

220       pg_receivewal(1)
221
222
223
224PostgreSQL 16.1                      2023                    PG_RECVLOGICAL(1)
Impressum