PostgreSQL provides two logical decoding output plugins,pgoutput andtest_decoding. You can also develop custom output plugins (seeSection 47.7 for details).
pgoutput
is the standard logical decoding output plugin provided byPostgreSQL. It's used for the built-inlogical replication.
proto_version
(integer
)#Specifies the protocol version. Currently versions1
,2
,3
, and4
are supported. A valid version is required.
Version2
is supported on server version 14 and above, and is required whenstreaming
is set toon
to stream large in-progress transactions.
Version3
is supported on server version 15 and above, and is required whentwo_phase
is enabled to stream two-phase commits.
Version4
is supported on server version 16 and above, and is required whenstreaming
is set toparallel
to stream large in-progress transactions to be applied in parallel.
publication_names
(string
)#A comma-separated list of publication names to subscribe to. The individual publication names are treated as standard objects names and can be quoted the same as needed. At least one publication name is required.
binary
(boolean
)#Enables binary transfer mode. Binary mode is faster than the text mode but slightly less robust. The default isoff
.
messages
(boolean
)#Enables sending the messages that are written bypg_logical_emit_message
. The default isoff
.
streaming
(enum
)#Enables streaming of in-progress transactions. Valid values areoff
(the default),on
andparallel
.
When set tooff
,pgoutput
fully decodes a transaction before sending it as a whole. This mode works with any protocol version.
When set toon
,pgoutput
streams large in-progress transactions. This requires protocol version 2 or higher.
When set toparallel
,pgoutput
streams large in-progress transactions and also sends extra information in some messages to support parallel processing. This requires protocol version 4 or higher.
two_phase
(boolean
)#Enables sending two-phase transactions. Minimum protocol version 3 is required to turn it on. The default isoff
.
origin
(enum
)#Specifies whether to send changes by their origin. Possible values arenone
to only send the changes that have no origin associated, orany
to send the changes regardless of their origin. This can be used to avoid loops (infinite replication of the same data) among replication nodes. The default isany
.
pgoutput
produces binary output, so functions expecting textual data (pg_logical_slot_peek_changes
andpg_logical_slot_get_changes
) cannot be used with it. Usepg_logical_slot_peek_binary_changes
orpg_logical_slot_get_binary_changes
instead.