This project is still a work in progress -- use at your own risk!
The decoder plugin resides under the decoder subdirectory. In order to build
it first make sure PGXS is installed, then enter the subdirectory and run
make
followed by make install
.
Before you can use logical decoding, you must set wal_level to logical and max_replication_slots to at least 1. Now you can create a replication slot:
SELECT * FROM pg_create_logical_replication_slot('my_application', 'pg_pb3_ld');
and connect to it. The replication level START_REPLICATION
command can
specify a list of options which control various details of the decoding output.
For detailed descriptions of the available options, see the "Options" section
below.
If enabled, a BeginTransaction message is sent at the beginning of each decoded transaction.
The default is false.
If enabled, a CommitTransaction message is sent at the end of each decoded transaction.
The default is true.
Controls how the type_oids
field in FieldSetDescription messages is written.
There are three supported modes:
- In
disabled
mode thetype_oids
protocol fields are never present. - In
omit_nulls
mode, thetype_oids
protocol fields contain only the type oids of non-NULL fields. - In
full
mode the full list of type oids is always provided.
The default is disabled.
A comma-separated list of oid ranges to decode as binary values. The minimum and the maximum of a range should be separated by HYPHEN-MINUS (-). Both the minimum and the maximum of a range are inclusive, i.e. all ranges are closed. A single value can be specified by omitting the maximum value and the HYPHEN-MINUS character. The ranges should appear in the list ordered by their minimum value, and no two ranges should overlap.
The default is the empty list, meaning that all values are sent to the client in text format.
Examples:
1-9999
sends all values of built-in types over in binary17,20-21,23
sends bytea, int2, int4 and int8 values over in binary
Controls how the formats
field in FieldSetDescription messages is written.
There are four supported modes:
- In
disabled
mode theformats
protocol fields are never present. - In
omit_nulls
mode theformats
protocol fields only contain entries for non-NULL values. - The
full
mode works exactly the same way as theomit_nulls
mode, except the field is never omitted.
The default is disabled.
If enabled, each TableDescription message includes the oid of the target table in the table_oid field.
The default is false.