decoderbufs
decoderbufs
decoderbufs : Logical decoding plugin that delivers WAL stream changes using a Protocol Buffer format
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 9650 | decoderbufs
|
decoderbufs
|
3.4.1 |
ETL
|
MIT
|
C
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--sL---
|
No
|
Yes
|
Yes
|
No
|
no
|
no
|
| Relationships | |
|---|---|
| See Also | pglogical
wal2json
decoder_raw
test_decoding
kafka_fdw
pglogical_origin
pglogical_ticker
pg_failover_slots
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG
|
3.4.1 |
18
17
16
15
14
|
decoderbufs |
- |
| RPM | PGDG
|
3.4.1 |
18
17
16
15
14
|
postgres-decoderbufs_$v |
- |
| DEB | PGDG
|
3.4.0 |
18
17
16
15
14
|
postgresql-$v-decoderbufs |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
el8.aarch64
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
el9.x86_64
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
el9.aarch64
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
el10.x86_64
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
el10.aarch64
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
PGDG 3.4.1
|
d12.x86_64
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
d12.aarch64
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
d13.x86_64
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
d13.aarch64
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
u22.x86_64
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
u22.aarch64
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
u24.x86_64
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
u24.aarch64
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
PGDG 3.4.0
|
Source
Install
Make sure PGDG repo available:
pig repo add pgdg -u # add pgdg repo and update cacheInstall this extension with pig:
pig install decoderbufs; # install via package name, for the active PG version
pig install decoderbufs -v 18; # install for PG 18
pig install decoderbufs -v 17; # install for PG 17
pig install decoderbufs -v 16; # install for PG 16
pig install decoderbufs -v 15; # install for PG 15
pig install decoderbufs -v 14; # install for PG 14Config this extension to shared_preload_libraries:
shared_preload_libraries = 'decoderbufs';This extension does not need CREATE EXTENSION DDL command
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 = 4Using 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
Last updated on