decoder_raw
Output plugin for logical replication in Raw SQL format
Repository
main/decoder_raw
https://github.com/michaelpq/pg_plugins/blob/main/decoder_raw/
Source
decoder_raw-1.0.tar.gz
decoder_raw-1.0.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
decoder_raw | 1.0 | ETL | PostgreSQL | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 9660 | decoder_raw | No | Yes | No | No | No | No | - |
| Related | pglogical wal2json decoderbufs test_decoding pg_failover_slots pgactive wal2mongo pgoutput |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0 | 1817161514 | decoder_raw | - |
| RPM | PIGSTY | 1.0 | 1817161514 | decoder_raw_$v | - |
| DEB | PIGSTY | 1.0 | 1817161514 | postgresql-$v-decoder-raw | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 1.0 el8.x86_64.pg18 : decoder_raw_18 decoder_raw_18-1.0-1PIGSTY.el8.x86_64.rpm
| PIGSTY 1.0 el8.x86_64.pg17 : decoder_raw_17 decoder_raw_17-1.0-1PIGSTY.el8.x86_64.rpm
| PIGSTY 1.0 el8.x86_64.pg16 : decoder_raw_16 decoder_raw_16-1.0-1PIGSTY.el8.x86_64.rpm
| PIGSTY 1.0 el8.x86_64.pg15 : decoder_raw_15 decoder_raw_15-1.0-1PIGSTY.el8.x86_64.rpm
| PIGSTY 1.0 el8.x86_64.pg14 : decoder_raw_14 decoder_raw_14-1.0-1PIGSTY.el8.x86_64.rpm
|
| el8.aarch64 | PIGSTY 1.0 el8.aarch64.pg18 : decoder_raw_18 decoder_raw_18-1.0-1PIGSTY.el8.aarch64.rpm
| PIGSTY 1.0 el8.aarch64.pg17 : decoder_raw_17 decoder_raw_17-1.0-1PIGSTY.el8.aarch64.rpm
| PIGSTY 1.0 el8.aarch64.pg16 : decoder_raw_16 decoder_raw_16-1.0-1PIGSTY.el8.aarch64.rpm
| PIGSTY 1.0 el8.aarch64.pg15 : decoder_raw_15 decoder_raw_15-1.0-1PIGSTY.el8.aarch64.rpm
| PIGSTY 1.0 el8.aarch64.pg14 : decoder_raw_14 decoder_raw_14-1.0-1PIGSTY.el8.aarch64.rpm
|
| el9.x86_64 | PIGSTY 1.0 el9.x86_64.pg18 : decoder_raw_18 decoder_raw_18-1.0-1PIGSTY.el9.x86_64.rpm
| PIGSTY 1.0 el9.x86_64.pg17 : decoder_raw_17 decoder_raw_17-1.0-1PIGSTY.el9.x86_64.rpm
| PIGSTY 1.0 el9.x86_64.pg16 : decoder_raw_16 decoder_raw_16-1.0-1PIGSTY.el9.x86_64.rpm
| PIGSTY 1.0 el9.x86_64.pg15 : decoder_raw_15 decoder_raw_15-1.0-1PIGSTY.el9.x86_64.rpm
| PIGSTY 1.0 el9.x86_64.pg14 : decoder_raw_14 decoder_raw_14-1.0-1PIGSTY.el9.x86_64.rpm
|
| el9.aarch64 | PIGSTY 1.0 el9.aarch64.pg18 : decoder_raw_18 decoder_raw_18-1.0-1PIGSTY.el9.aarch64.rpm
| PIGSTY 1.0 el9.aarch64.pg17 : decoder_raw_17 decoder_raw_17-1.0-1PIGSTY.el9.aarch64.rpm
| PIGSTY 1.0 el9.aarch64.pg16 : decoder_raw_16 decoder_raw_16-1.0-1PIGSTY.el9.aarch64.rpm
| PIGSTY 1.0 el9.aarch64.pg15 : decoder_raw_15 decoder_raw_15-1.0-1PIGSTY.el9.aarch64.rpm
| PIGSTY 1.0 el9.aarch64.pg14 : decoder_raw_14 decoder_raw_14-1.0-1PIGSTY.el9.aarch64.rpm
|
| el10.x86_64 | PIGSTY 1.0 el10.x86_64.pg18 : decoder_raw_18 decoder_raw_18-1.0-1PIGSTY.el10.x86_64.rpm
| PIGSTY 1.0 el10.x86_64.pg17 : decoder_raw_17 decoder_raw_17-1.0-1PIGSTY.el10.x86_64.rpm
| PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| el10.aarch64 | PIGSTY 1.0 el10.aarch64.pg18 : decoder_raw_18 decoder_raw_18-1.0-1PIGSTY.el10.aarch64.rpm
| PIGSTY 1.0 el10.aarch64.pg17 : decoder_raw_17 decoder_raw_17-1.0-1PIGSTY.el10.aarch64.rpm
| PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| d12.x86_64 | PIGSTY 1.0 d12.x86_64.pg18 : postgresql-18-decoder-raw postgresql-18-decoder-raw_1.0-1PIGSTY~bookworm_amd64.deb
| PIGSTY 1.0 d12.x86_64.pg17 : postgresql-17-decoder-raw postgresql-17-decoder-raw_1.0-1PIGSTY~bookworm_amd64.deb
| PIGSTY 1.0 d12.x86_64.pg16 : postgresql-16-decoder-raw postgresql-16-decoder-raw_1.0-1PIGSTY~bookworm_amd64.deb
| PIGSTY 1.0 d12.x86_64.pg15 : postgresql-15-decoder-raw postgresql-15-decoder-raw_1.0-1PIGSTY~bookworm_amd64.deb
| PIGSTY 1.0 d12.x86_64.pg14 : postgresql-14-decoder-raw postgresql-14-decoder-raw_1.0-1PIGSTY~bookworm_amd64.deb
|
| d12.aarch64 | PIGSTY 1.0 d12.aarch64.pg18 : postgresql-18-decoder-raw postgresql-18-decoder-raw_1.0-1PIGSTY~bookworm_arm64.deb
| PIGSTY 1.0 d12.aarch64.pg17 : postgresql-17-decoder-raw postgresql-17-decoder-raw_1.0-1PIGSTY~bookworm_arm64.deb
| PIGSTY 1.0 d12.aarch64.pg16 : postgresql-16-decoder-raw postgresql-16-decoder-raw_1.0-1PIGSTY~bookworm_arm64.deb
| PIGSTY 1.0 d12.aarch64.pg15 : postgresql-15-decoder-raw postgresql-15-decoder-raw_1.0-1PIGSTY~bookworm_arm64.deb
| PIGSTY 1.0 d12.aarch64.pg14 : postgresql-14-decoder-raw postgresql-14-decoder-raw_1.0-1PIGSTY~bookworm_arm64.deb
|
| d13.x86_64 | PIGSTY 1.0 d13.x86_64.pg18 : postgresql-18-decoder-raw postgresql-18-decoder-raw_1.0-1PIGSTY~trixie_amd64.deb
| PIGSTY 1.0 d13.x86_64.pg17 : postgresql-17-decoder-raw postgresql-17-decoder-raw_1.0-1PIGSTY~trixie_amd64.deb
| PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| d13.aarch64 | PIGSTY 1.0 d13.aarch64.pg18 : postgresql-18-decoder-raw postgresql-18-decoder-raw_1.0-1PIGSTY~trixie_arm64.deb
| PIGSTY 1.0 d13.aarch64.pg17 : postgresql-17-decoder-raw postgresql-17-decoder-raw_1.0-1PIGSTY~trixie_arm64.deb
| PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| u22.x86_64 | PIGSTY 1.0 u22.x86_64.pg18 : postgresql-18-decoder-raw postgresql-18-decoder-raw_1.0-1PIGSTY~jammy_amd64.deb
| PIGSTY 1.0 u22.x86_64.pg17 : postgresql-17-decoder-raw postgresql-17-decoder-raw_1.0-1PIGSTY~jammy_amd64.deb
| PIGSTY 1.0 u22.x86_64.pg16 : postgresql-16-decoder-raw postgresql-16-decoder-raw_1.0-1PIGSTY~jammy_amd64.deb
| PIGSTY 1.0 u22.x86_64.pg15 : postgresql-15-decoder-raw postgresql-15-decoder-raw_1.0-1PIGSTY~jammy_amd64.deb
| PIGSTY 1.0 u22.x86_64.pg14 : postgresql-14-decoder-raw postgresql-14-decoder-raw_1.0-1PIGSTY~jammy_amd64.deb
|
| u22.aarch64 | PIGSTY 1.0 u22.aarch64.pg18 : postgresql-18-decoder-raw postgresql-18-decoder-raw_1.0-1PIGSTY~jammy_arm64.deb
| PIGSTY 1.0 u22.aarch64.pg17 : postgresql-17-decoder-raw postgresql-17-decoder-raw_1.0-1PIGSTY~jammy_arm64.deb
| PIGSTY 1.0 u22.aarch64.pg16 : postgresql-16-decoder-raw postgresql-16-decoder-raw_1.0-1PIGSTY~jammy_arm64.deb
| PIGSTY 1.0 u22.aarch64.pg15 : postgresql-15-decoder-raw postgresql-15-decoder-raw_1.0-1PIGSTY~jammy_arm64.deb
| PIGSTY 1.0 u22.aarch64.pg14 : postgresql-14-decoder-raw postgresql-14-decoder-raw_1.0-1PIGSTY~jammy_arm64.deb
|
| u24.x86_64 | PIGSTY 1.0 u24.x86_64.pg18 : postgresql-18-decoder-raw postgresql-18-decoder-raw_1.0-1PIGSTY~noble_amd64.deb
| PIGSTY 1.0 u24.x86_64.pg17 : postgresql-17-decoder-raw postgresql-17-decoder-raw_1.0-1PIGSTY~noble_amd64.deb
| PIGSTY 1.0 u24.x86_64.pg16 : postgresql-16-decoder-raw postgresql-16-decoder-raw_1.0-1PIGSTY~noble_amd64.deb
| PIGSTY 1.0 u24.x86_64.pg15 : postgresql-15-decoder-raw postgresql-15-decoder-raw_1.0-1PIGSTY~noble_amd64.deb
| PIGSTY 1.0 u24.x86_64.pg14 : postgresql-14-decoder-raw postgresql-14-decoder-raw_1.0-1PIGSTY~noble_amd64.deb
|
| u24.aarch64 | PIGSTY 1.0 u24.aarch64.pg18 : postgresql-18-decoder-raw postgresql-18-decoder-raw_1.0-1PIGSTY~noble_arm64.deb
| PIGSTY 1.0 u24.aarch64.pg17 : postgresql-17-decoder-raw postgresql-17-decoder-raw_1.0-1PIGSTY~noble_arm64.deb
| PIGSTY 1.0 u24.aarch64.pg16 : postgresql-16-decoder-raw postgresql-16-decoder-raw_1.0-1PIGSTY~noble_arm64.deb
| PIGSTY 1.0 u24.aarch64.pg15 : postgresql-15-decoder-raw postgresql-15-decoder-raw_1.0-1PIGSTY~noble_arm64.deb
| PIGSTY 1.0 u24.aarch64.pg14 : postgresql-14-decoder-raw postgresql-14-decoder-raw_1.0-1PIGSTY~noble_arm64.deb
|
Build
You can build the RPM / DEB packages for decoder_raw using pig build:
pig build pkg decoder_raw # build RPM / DEB packages
Install
You can install decoder_raw directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
pig repo add pgsql -u # Add repo and update cache
Install the extension using pig or apt/yum/dnf:
pig install decoder_raw; # Install for current active PG version
pig ext install -y decoder_raw -v 18 # PG 18
pig ext install -y decoder_raw -v 17 # PG 17
pig ext install -y decoder_raw -v 16 # PG 16
pig ext install -y decoder_raw -v 15 # PG 15
pig ext install -y decoder_raw -v 14 # PG 14
dnf install -y decoder_raw_18 # PG 18
dnf install -y decoder_raw_17 # PG 17
dnf install -y decoder_raw_16 # PG 16
dnf install -y decoder_raw_15 # PG 15
dnf install -y decoder_raw_14 # PG 14
apt install -y postgresql-18-decoder-raw # PG 18
apt install -y postgresql-17-decoder-raw # PG 17
apt install -y postgresql-16-decoder-raw # PG 16
apt install -y postgresql-15-decoder-raw # PG 15
apt install -y postgresql-14-decoder-raw # PG 14
This extension does not require
CREATE EXTENSION
Usage
decoder_raw: Output plugin for logical replication in Raw SQL format
A logical decoding output plugin that converts WAL changes into raw SQL statements. Part of the pg_plugins collection by Michael Paquier.
Configuration
In postgresql.conf:
wal_level = logical
max_replication_slots = 10
max_wal_senders = 10
Using with SQL Functions
-- Create a logical replication slot
SELECT * FROM pg_create_logical_replication_slot('raw_slot', 'decoder_raw');
-- Perform DML operations
INSERT INTO my_table VALUES (1, 'hello');
UPDATE my_table SET val = 'world' WHERE id = 1;
DELETE FROM my_table WHERE id = 1;
-- Get changes as raw SQL
SELECT data FROM pg_logical_slot_get_changes('raw_slot', NULL, NULL);
-- Output:
-- INSERT INTO public.my_table (id, val) VALUES (1, 'hello');
-- UPDATE public.my_table SET val = 'world' WHERE id = 1;
-- DELETE FROM public.my_table WHERE id = 1;
-- Drop the slot
SELECT pg_drop_replication_slot('raw_slot');
Using with pg_recvlogical
# Create slot
pg_recvlogical -d postgres --slot raw_slot --create-slot -P decoder_raw
# Stream changes as SQL statements
pg_recvlogical -d postgres --slot raw_slot --start -f -
# Drop slot
pg_recvlogical -d postgres --slot raw_slot --drop-slot
Key Features
- Outputs changes as executable SQL statements (INSERT, UPDATE, DELETE)
- Useful for debugging logical decoding or replaying changes on another database
- Tables should have REPLICA IDENTITY set for proper UPDATE/DELETE output
- Lightweight plugin designed as a template for custom logical decoding plugins
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.