Logical Decoding Output Plugins
Logical Decoding Output Plugins
PostgreSQL provides two logical decoding output plugins, pgoutput and test_decoding. You can also develop custom output plugins (see Writing Logical Decoding Output Plugins for details).
pgoutput — Standard Logical Decoding Output Plugin
pgoutput is the standard logical decoding output plugin provided by PostgreSQL. It's used for the built-in logical replication.
Options
proto_version(integer)-
Specifies the protocol version. Currently versions
1,2,3, and4are supported. A valid version is required.Version
2is supported on server version 14 and above, and is required whenstreamingis set toonto stream large in-progress transactions.Version
3is supported on server version 15 and above, and is required whentwo_phaseis enabled to stream two-phase commits.Version
4is supported on server version 16 and above, and is required whenstreamingis set toparallelto 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 is
off. messages(boolean)- Enables sending the messages that are written by
[pg_logical_emit_message](../../the-sql-language/functions-and-operators/system-administration-functions.md#pg-logical-emit-message). The default isoff. streaming(enum)-
Enables streaming of in-progress transactions. Valid values are
off(the default),onandparallel.When set to
off,pgoutputfully decodes a transaction before sending it as a whole. This mode works with any protocol version.When set to
on,pgoutputstreams large in-progress transactions. This requires protocol version 2 or higher.When set to
parallel,pgoutputstreams 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 is
off. origin(enum)- Specifies whether to send changes by their origin. Possible values are
noneto only send the changes that have no origin associated, oranyto 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.
Notes
pgoutput produces binary output, so functions expecting textual data ( [pg_logical_slot_peek_changes](../../the-sql-language/functions-and-operators/system-administration-functions.md#pg-logical-slot-peek-changes) and [pg_logical_slot_get_changes](../../the-sql-language/functions-and-operators/system-administration-functions.md#pg-logical-slot-get-changes)) cannot be used with it. Use [pg_logical_slot_peek_binary_changes](../../the-sql-language/functions-and-operators/system-administration-functions.md#pg-logical-slot-peek-binary-changes) or [pg_logical_slot_get_binary_changes](../../the-sql-language/functions-and-operators/system-administration-functions.md#pg-logical-slot-get-binary-changes) instead.