1PG_RECVLOGICAL(1)        PostgreSQL 14.3 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

OPTIONS

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

ENVIRONMENT

189       This utility, like most other PostgreSQL utilities, uses the
190       environment variables supported by libpq (see Section 34.15).
191
192       The environment variable PG_COLOR specifies whether to use color in
193       diagnostic messages. Possible values are always, auto and never.
194

NOTES

196       pg_recvlogical will preserve group permissions on the received WAL
197       files if group permissions are enabled on the source cluster.
198

EXAMPLES

200       See Section 49.1 for an example.
201

SEE ALSO

203       pg_receivewal(1)
204
205
206
207PostgreSQL 14.3                      2022                    PG_RECVLOGICAL(1)
Impressum