decoderbufs

Logical decoding plugin that delivers WAL stream changes using a Protocol Buffer format

Overview

PackageVersionCategoryLicenseLanguage
decoderbufs3.5.0ETLMITC
IDExtensionBinLibLoadCreateTrustRelocSchema
9650decoderbufsNoYesYesNoNoNo-
Relatedpglogical wal2json decoder_raw test_decoding kafka_fdw pglogical_origin pglogical_ticker pg_failover_slots

Version

TypeRepoVersionPG VerPackageDeps
EXTPGDG3.5.01817161514decoderbufs-
RPMPGDG3.4.11817161514postgres-decoderbufs_$v-
DEBPGDG3.5.01817161514postgresql-$v-decoderbufs-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
d12.aarch64
d13.x86_64
d13.aarch64
u22.x86_64
u22.aarch64
u24.x86_64
u24.aarch64

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

Preload:

shared_preload_libraries = 'decoderbufs';

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 TypeProtobuf Field
BOOLdatum_boolean
INT2, INT4datum_int32
INT8, OIDdatum_int64
FLOAT4datum_float
FLOAT8, NUMERICdatum_double
CHAR, VARCHAR, TEXTdatum_string
JSON, XML, UUIDdatum_string
TIMESTAMP(TZ)datum_string
BYTEAdatum_bytes
POINT, PostGISdatum_point

Notes

  • For UPDATE/DELETE, set REPLICA IDENTITY appropriately
  • Binary Protocol Buffer output is consumed by the Debezium Postgres Connector
  • debug-mode option provides human-readable text output for SQL console testing
  • Requires protobuf-c library and PostGIS development packages for compilation

Last Modified 2026-04-15: routine extension update (77993e8)