decoderbufs
Logical decoding plugin that delivers WAL stream changes using a Protocol Buffer format
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
decoderbufs | 3.4.1 | ETL | MIT | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 9650 | decoderbufs | No | Yes | No | No | No | No | - |
| Related | pglogical wal2json decoder_raw test_decoding kafka_fdw pglogical_origin pglogical_ticker pg_failover_slots |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PGDG | 3.4.1 | 1817161514 | decoderbufs | - |
| RPM | PGDG | 3.4.1 | 1817161514 | postgres-decoderbufs_$v | - |
| DEB | PGDG | 3.4.0 | 1817161514 | postgresql-$v-decoderbufs | - |
Install
You can install decoderbufs directly. First, make sure the PGDG repository is added and enabled:
pig repo add pgdg -u # Add PGDG repo and update cache
Install the extension using pig or apt/yum/dnf:
pig install decoderbufs; # Install for current active PG version
pig ext install -y decoderbufs -v 18 # PG 18
pig ext install -y decoderbufs -v 17 # PG 17
pig ext install -y decoderbufs -v 16 # PG 16
pig ext install -y decoderbufs -v 15 # PG 15
pig ext install -y decoderbufs -v 14 # PG 14
dnf install -y postgres-decoderbufs_18 # PG 18
dnf install -y postgres-decoderbufs_17 # PG 17
dnf install -y postgres-decoderbufs_16 # PG 16
dnf install -y postgres-decoderbufs_15 # PG 15
dnf install -y postgres-decoderbufs_14 # PG 14
apt install -y postgresql-18-decoderbufs # PG 18
apt install -y postgresql-17-decoderbufs # PG 17
apt install -y postgresql-16-decoderbufs # PG 16
apt install -y postgresql-15-decoderbufs # PG 15
apt install -y postgresql-14-decoderbufs # PG 14
This extension does not require
CREATE EXTENSION
Usage
decoderbufs: Logical decoding plugin that delivers WAL stream changes using a Protocol Buffer format
A PostgreSQL logical decoding output plugin that serializes WAL changes into Protocol Buffers format, primarily used by the Debezium PostgreSQL connector for change data capture.
Configuration
In postgresql.conf:
shared_preload_libraries = 'decoderbufs'
wal_level = logical
max_wal_senders = 8
max_replication_slots = 4
Using with SQL (Debug Mode)
-- Create a logical replication slot
SELECT * FROM pg_create_logical_replication_slot('decoderbufs_demo', 'decoderbufs');
-- Perform table modifications
INSERT INTO my_table VALUES (1, 'test');
UPDATE my_table SET col = 'updated' WHERE id = 1;
-- Peek at changes in debug text mode
SELECT data FROM pg_logical_slot_peek_changes(
'decoderbufs_demo', NULL, NULL, 'debug-mode', '1');
-- Consume changes
SELECT data FROM pg_logical_slot_get_changes(
'decoderbufs_demo', NULL, NULL, 'debug-mode', '1');
-- Check slot status
SELECT * FROM pg_replication_slots WHERE slot_type = 'logical';
Type Mappings
| PostgreSQL Type | Protobuf Field |
|---|---|
| BOOL | datum_boolean |
| INT2, INT4 | datum_int32 |
| INT8, OID | datum_int64 |
| FLOAT4 | datum_float |
| FLOAT8, NUMERIC | datum_double |
| CHAR, VARCHAR, TEXT | datum_string |
| JSON, XML, UUID | datum_string |
| TIMESTAMP(TZ) | datum_string |
| BYTEA | datum_bytes |
| POINT, PostGIS | datum_point |
Notes
- For UPDATE/DELETE, set REPLICA IDENTITY appropriately
- Binary Protocol Buffer output is consumed by the Debezium Postgres Connector
debug-modeoption provides human-readable text output for SQL console testing- Requires
protobuf-clibrary and PostGIS development packages for compilation
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.