decoder_raw

decoder_raw

decoder_raw : Output plugin for logical replication in Raw SQL format

Overview

ID Extension Package Version Category License Language
9660
decoder_raw
decoder_raw
1.0
ETL
PostgreSQL
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--s----
No
Yes
No
No
no
no
Relationships
See Also
pglogical
wal2json
decoderbufs
test_decoding
pg_failover_slots
pgactive
wal2mongo
pgoutput

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
1.0
18
17
16
15
14
decoder_raw -
RPM
PIGSTY
1.0
18
17
16
15
14
decoder_raw_$v -
DEB
PIGSTY
1.0
18
17
16
15
14
postgresql-$v-decoder-raw -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
el8.aarch64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
el9.x86_64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
el9.aarch64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
el10.x86_64
PIGSTY 1.0
PIGSTY 1.0
MISS
MISS
MISS
el10.aarch64
PIGSTY 1.0
PIGSTY 1.0
MISS
MISS
MISS
d12.x86_64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
d12.aarch64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
d13.x86_64
PIGSTY 1.0
PIGSTY 1.0
MISS
MISS
MISS
d13.aarch64
PIGSTY 1.0
PIGSTY 1.0
MISS
MISS
MISS
u22.x86_64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
u22.aarch64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
u24.x86_64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
u24.aarch64
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
PIGSTY 1.0
Package Version OS ORG SIZE File URL
decoder_raw_18 1.0 el8.x86_64 pigsty 15.2 KiB decoder_raw_18-1.0-1PIGSTY.el8.x86_64.rpm
decoder_raw_18 1.0 el8.aarch64 pigsty 15.2 KiB decoder_raw_18-1.0-1PIGSTY.el8.aarch64.rpm
decoder_raw_18 1.0 el9.x86_64 pigsty 14.9 KiB decoder_raw_18-1.0-1PIGSTY.el9.x86_64.rpm
decoder_raw_18 1.0 el9.aarch64 pigsty 14.7 KiB decoder_raw_18-1.0-1PIGSTY.el9.aarch64.rpm
decoder_raw_18 1.0 el10.x86_64 pigsty 15.0 KiB decoder_raw_18-1.0-1PIGSTY.el10.x86_64.rpm
decoder_raw_18 1.0 el10.aarch64 pigsty 14.9 KiB decoder_raw_18-1.0-1PIGSTY.el10.aarch64.rpm
postgresql-18-decoder-raw 1.0 d12.x86_64 pigsty 16.6 KiB postgresql-18-decoder-raw_1.0-1PIGSTY~bookworm_amd64.deb
postgresql-18-decoder-raw 1.0 d12.aarch64 pigsty 16.5 KiB postgresql-18-decoder-raw_1.0-1PIGSTY~bookworm_arm64.deb
postgresql-18-decoder-raw 1.0 d13.x86_64 pigsty 16.6 KiB postgresql-18-decoder-raw_1.0-1PIGSTY~trixie_amd64.deb
postgresql-18-decoder-raw 1.0 d13.aarch64 pigsty 16.6 KiB postgresql-18-decoder-raw_1.0-1PIGSTY~trixie_arm64.deb
postgresql-18-decoder-raw 1.0 u22.x86_64 pigsty 17.9 KiB postgresql-18-decoder-raw_1.0-1PIGSTY~jammy_amd64.deb
postgresql-18-decoder-raw 1.0 u22.aarch64 pigsty 17.5 KiB postgresql-18-decoder-raw_1.0-1PIGSTY~jammy_arm64.deb
postgresql-18-decoder-raw 1.0 u24.x86_64 pigsty 17.3 KiB postgresql-18-decoder-raw_1.0-1PIGSTY~noble_amd64.deb
postgresql-18-decoder-raw 1.0 u24.aarch64 pigsty 17.3 KiB postgresql-18-decoder-raw_1.0-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
decoder_raw_17 1.0 el8.x86_64 pigsty 15.2 KiB decoder_raw_17-1.0-1PIGSTY.el8.x86_64.rpm
decoder_raw_17 1.0 el8.aarch64 pigsty 15.3 KiB decoder_raw_17-1.0-1PIGSTY.el8.aarch64.rpm
decoder_raw_17 1.0 el9.x86_64 pigsty 14.9 KiB decoder_raw_17-1.0-1PIGSTY.el9.x86_64.rpm
decoder_raw_17 1.0 el9.aarch64 pigsty 14.7 KiB decoder_raw_17-1.0-1PIGSTY.el9.aarch64.rpm
decoder_raw_17 1.0 el10.x86_64 pigsty 15.0 KiB decoder_raw_17-1.0-1PIGSTY.el10.x86_64.rpm
decoder_raw_17 1.0 el10.aarch64 pigsty 15.0 KiB decoder_raw_17-1.0-1PIGSTY.el10.aarch64.rpm
postgresql-17-decoder-raw 1.0 d12.x86_64 pigsty 16.5 KiB postgresql-17-decoder-raw_1.0-1PIGSTY~bookworm_amd64.deb
postgresql-17-decoder-raw 1.0 d12.aarch64 pigsty 16.5 KiB postgresql-17-decoder-raw_1.0-1PIGSTY~bookworm_arm64.deb
postgresql-17-decoder-raw 1.0 d13.x86_64 pigsty 16.4 KiB postgresql-17-decoder-raw_1.0-1PIGSTY~trixie_amd64.deb
postgresql-17-decoder-raw 1.0 d13.aarch64 pigsty 16.6 KiB postgresql-17-decoder-raw_1.0-1PIGSTY~trixie_arm64.deb
postgresql-17-decoder-raw 1.0 u22.x86_64 pigsty 20.1 KiB postgresql-17-decoder-raw_1.0-1PIGSTY~jammy_amd64.deb
postgresql-17-decoder-raw 1.0 u22.aarch64 pigsty 19.7 KiB postgresql-17-decoder-raw_1.0-1PIGSTY~jammy_arm64.deb
postgresql-17-decoder-raw 1.0 u24.x86_64 pigsty 17.1 KiB postgresql-17-decoder-raw_1.0-1PIGSTY~noble_amd64.deb
postgresql-17-decoder-raw 1.0 u24.aarch64 pigsty 17.3 KiB postgresql-17-decoder-raw_1.0-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
decoder_raw_16 1.0 el8.x86_64 pigsty 15.2 KiB decoder_raw_16-1.0-1PIGSTY.el8.x86_64.rpm
decoder_raw_16 1.0 el8.aarch64 pigsty 15.3 KiB decoder_raw_16-1.0-1PIGSTY.el8.aarch64.rpm
decoder_raw_16 1.0 el9.x86_64 pigsty 14.8 KiB decoder_raw_16-1.0-1PIGSTY.el9.x86_64.rpm
decoder_raw_16 1.0 el9.aarch64 pigsty 14.7 KiB decoder_raw_16-1.0-1PIGSTY.el9.aarch64.rpm
postgresql-16-decoder-raw 1.0 d12.x86_64 pigsty 16.5 KiB postgresql-16-decoder-raw_1.0-1PIGSTY~bookworm_amd64.deb
postgresql-16-decoder-raw 1.0 d12.aarch64 pigsty 16.5 KiB postgresql-16-decoder-raw_1.0-1PIGSTY~bookworm_arm64.deb
postgresql-16-decoder-raw 1.0 u22.x86_64 pigsty 20.1 KiB postgresql-16-decoder-raw_1.0-1PIGSTY~jammy_amd64.deb
postgresql-16-decoder-raw 1.0 u22.aarch64 pigsty 19.7 KiB postgresql-16-decoder-raw_1.0-1PIGSTY~jammy_arm64.deb
postgresql-16-decoder-raw 1.0 u24.x86_64 pigsty 17.1 KiB postgresql-16-decoder-raw_1.0-1PIGSTY~noble_amd64.deb
postgresql-16-decoder-raw 1.0 u24.aarch64 pigsty 17.3 KiB postgresql-16-decoder-raw_1.0-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
decoder_raw_15 1.0 el8.x86_64 pigsty 15.0 KiB decoder_raw_15-1.0-1PIGSTY.el8.x86_64.rpm
decoder_raw_15 1.0 el8.aarch64 pigsty 15.1 KiB decoder_raw_15-1.0-1PIGSTY.el8.aarch64.rpm
decoder_raw_15 1.0 el9.x86_64 pigsty 14.7 KiB decoder_raw_15-1.0-1PIGSTY.el9.x86_64.rpm
decoder_raw_15 1.0 el9.aarch64 pigsty 14.6 KiB decoder_raw_15-1.0-1PIGSTY.el9.aarch64.rpm
postgresql-15-decoder-raw 1.0 d12.x86_64 pigsty 16.1 KiB postgresql-15-decoder-raw_1.0-1PIGSTY~bookworm_amd64.deb
postgresql-15-decoder-raw 1.0 d12.aarch64 pigsty 16.2 KiB postgresql-15-decoder-raw_1.0-1PIGSTY~bookworm_arm64.deb
postgresql-15-decoder-raw 1.0 u22.x86_64 pigsty 19.7 KiB postgresql-15-decoder-raw_1.0-1PIGSTY~jammy_amd64.deb
postgresql-15-decoder-raw 1.0 u22.aarch64 pigsty 19.3 KiB postgresql-15-decoder-raw_1.0-1PIGSTY~jammy_arm64.deb
postgresql-15-decoder-raw 1.0 u24.x86_64 pigsty 16.8 KiB postgresql-15-decoder-raw_1.0-1PIGSTY~noble_amd64.deb
postgresql-15-decoder-raw 1.0 u24.aarch64 pigsty 17.0 KiB postgresql-15-decoder-raw_1.0-1PIGSTY~noble_arm64.deb
Package Version OS ORG SIZE File URL
decoder_raw_14 1.0 el8.x86_64 pigsty 15.0 KiB decoder_raw_14-1.0-1PIGSTY.el8.x86_64.rpm
decoder_raw_14 1.0 el8.aarch64 pigsty 15.1 KiB decoder_raw_14-1.0-1PIGSTY.el8.aarch64.rpm
decoder_raw_14 1.0 el9.x86_64 pigsty 15.0 KiB decoder_raw_14-1.0-1PIGSTY.el9.x86_64.rpm
decoder_raw_14 1.0 el9.aarch64 pigsty 14.9 KiB decoder_raw_14-1.0-1PIGSTY.el9.aarch64.rpm
postgresql-14-decoder-raw 1.0 d12.x86_64 pigsty 16.8 KiB postgresql-14-decoder-raw_1.0-1PIGSTY~bookworm_amd64.deb
postgresql-14-decoder-raw 1.0 d12.aarch64 pigsty 16.6 KiB postgresql-14-decoder-raw_1.0-1PIGSTY~bookworm_arm64.deb
postgresql-14-decoder-raw 1.0 u22.x86_64 pigsty 20.3 KiB postgresql-14-decoder-raw_1.0-1PIGSTY~jammy_amd64.deb
postgresql-14-decoder-raw 1.0 u22.aarch64 pigsty 19.9 KiB postgresql-14-decoder-raw_1.0-1PIGSTY~jammy_arm64.deb
postgresql-14-decoder-raw 1.0 u24.x86_64 pigsty 17.5 KiB postgresql-14-decoder-raw_1.0-1PIGSTY~noble_amd64.deb
postgresql-14-decoder-raw 1.0 u24.aarch64 pigsty 17.4 KiB postgresql-14-decoder-raw_1.0-1PIGSTY~noble_arm64.deb

Source

pig build pkg decoder_raw;# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u # add both repo and update cache

Install this extension with pig:

pig install decoder_raw;# install via package name, for the active PG version  pig install decoder_raw -v 18; # install for PG 18 pig install decoder_raw -v 17; # install for PG 17 pig install decoder_raw -v 16; # install for PG 16 pig install decoder_raw -v 15; # install for PG 15 pig install decoder_raw -v 14; # install for PG 14

This extension does not need CREATE EXTENSION DDL command

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
Last updated on