pgmqtt
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pgmqtt | 0.5.1 | ETL | Elastic-2.0 | Rust |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 9620 | pgmqtt | No | Yes | Yes | Yes | No | No | - |
| Related | wal2json decoderbufs pgq kafka_fdw pgmq pgmb ulak tcn redis test_decoding |
|---|
Requires preload for broker/CDC. CDC requires logical WAL; affected PostgreSQL releases also require pgmqtt in output_plugin_libraries.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.5.1 | 1817161514 | pgmqtt | - |
| RPM | PIGSTY | 0.5.1 | 1817161514 | pgmqtt_$v | - |
| DEB | PIGSTY | 0.5.1 | 1817161514 | postgresql-$v-pgmqtt | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.5.1 el8.x86_64.pg18 : pgmqtt_18 pgmqtt_18-0.5.1-1PGSTY.el8.x86_64.rpm
| PIGSTY 0.5.1 el8.x86_64.pg17 : pgmqtt_17 pgmqtt_17-0.5.1-1PGSTY.el8.x86_64.rpm
| PIGSTY 0.5.1 el8.x86_64.pg16 : pgmqtt_16 pgmqtt_16-0.5.1-1PGSTY.el8.x86_64.rpm
| PIGSTY 0.5.1 el8.x86_64.pg15 : pgmqtt_15 pgmqtt_15-0.5.1-1PGSTY.el8.x86_64.rpm
| PIGSTY 0.5.1 el8.x86_64.pg14 : pgmqtt_14 pgmqtt_14-0.5.1-1PGSTY.el8.x86_64.rpm
|
| el8.aarch64 | PIGSTY 0.5.1 el8.aarch64.pg18 : pgmqtt_18 pgmqtt_18-0.5.1-1PGSTY.el8.aarch64.rpm
| PIGSTY 0.5.1 el8.aarch64.pg17 : pgmqtt_17 pgmqtt_17-0.5.1-1PGSTY.el8.aarch64.rpm
| PIGSTY 0.5.1 el8.aarch64.pg16 : pgmqtt_16 pgmqtt_16-0.5.1-1PGSTY.el8.aarch64.rpm
| PIGSTY 0.5.1 el8.aarch64.pg15 : pgmqtt_15 pgmqtt_15-0.5.1-1PGSTY.el8.aarch64.rpm
| PIGSTY 0.5.1 el8.aarch64.pg14 : pgmqtt_14 pgmqtt_14-0.5.1-1PGSTY.el8.aarch64.rpm
|
| el9.x86_64 | PIGSTY 0.5.1 el9.x86_64.pg18 : pgmqtt_18 pgmqtt_18-0.5.1-1PGSTY.el9.x86_64.rpm
| PIGSTY 0.5.1 el9.x86_64.pg17 : pgmqtt_17 pgmqtt_17-0.5.1-1PGSTY.el9.x86_64.rpm
| PIGSTY 0.5.1 el9.x86_64.pg16 : pgmqtt_16 pgmqtt_16-0.5.1-1PGSTY.el9.x86_64.rpm
| PIGSTY 0.5.1 el9.x86_64.pg15 : pgmqtt_15 pgmqtt_15-0.5.1-1PGSTY.el9.x86_64.rpm
| PIGSTY 0.5.1 el9.x86_64.pg14 : pgmqtt_14 pgmqtt_14-0.5.1-1PGSTY.el9.x86_64.rpm
|
| el9.aarch64 | PIGSTY 0.5.1 el9.aarch64.pg18 : pgmqtt_18 pgmqtt_18-0.5.1-1PGSTY.el9.aarch64.rpm
| PIGSTY 0.5.1 el9.aarch64.pg17 : pgmqtt_17 pgmqtt_17-0.5.1-1PGSTY.el9.aarch64.rpm
| PIGSTY 0.5.1 el9.aarch64.pg16 : pgmqtt_16 pgmqtt_16-0.5.1-1PGSTY.el9.aarch64.rpm
| PIGSTY 0.5.1 el9.aarch64.pg15 : pgmqtt_15 pgmqtt_15-0.5.1-1PGSTY.el9.aarch64.rpm
| PIGSTY 0.5.1 el9.aarch64.pg14 : pgmqtt_14 pgmqtt_14-0.5.1-1PGSTY.el9.aarch64.rpm
|
| el10.x86_64 | PIGSTY 0.5.1 el10.x86_64.pg18 : pgmqtt_18 pgmqtt_18-0.5.1-1PGSTY.el10.x86_64.rpm
| PIGSTY 0.5.1 el10.x86_64.pg17 : pgmqtt_17 pgmqtt_17-0.5.1-1PGSTY.el10.x86_64.rpm
| PIGSTY 0.5.1 el10.x86_64.pg16 : pgmqtt_16 pgmqtt_16-0.5.1-1PGSTY.el10.x86_64.rpm
| PIGSTY 0.5.1 el10.x86_64.pg15 : pgmqtt_15 pgmqtt_15-0.5.1-1PGSTY.el10.x86_64.rpm
| PIGSTY 0.5.1 el10.x86_64.pg14 : pgmqtt_14 pgmqtt_14-0.5.1-1PGSTY.el10.x86_64.rpm
|
| el10.aarch64 | PIGSTY 0.5.1 el10.aarch64.pg18 : pgmqtt_18 pgmqtt_18-0.5.1-1PGSTY.el10.aarch64.rpm
| PIGSTY 0.5.1 el10.aarch64.pg17 : pgmqtt_17 pgmqtt_17-0.5.1-1PGSTY.el10.aarch64.rpm
| PIGSTY 0.5.1 el10.aarch64.pg16 : pgmqtt_16 pgmqtt_16-0.5.1-1PGSTY.el10.aarch64.rpm
| PIGSTY 0.5.1 el10.aarch64.pg15 : pgmqtt_15 pgmqtt_15-0.5.1-1PGSTY.el10.aarch64.rpm
| PIGSTY 0.5.1 el10.aarch64.pg14 : pgmqtt_14 pgmqtt_14-0.5.1-1PGSTY.el10.aarch64.rpm
|
| d12.x86_64 | PIGSTY 0.5.1 d12.x86_64.pg18 : postgresql-18-pgmqtt postgresql-18-pgmqtt_0.5.1-1PGSTY~bookworm_amd64.deb
| PIGSTY 0.5.1 d12.x86_64.pg17 : postgresql-17-pgmqtt postgresql-17-pgmqtt_0.5.1-1PGSTY~bookworm_amd64.deb
| PIGSTY 0.5.1 d12.x86_64.pg16 : postgresql-16-pgmqtt postgresql-16-pgmqtt_0.5.1-1PGSTY~bookworm_amd64.deb
| PIGSTY 0.5.1 d12.x86_64.pg15 : postgresql-15-pgmqtt postgresql-15-pgmqtt_0.5.1-1PGSTY~bookworm_amd64.deb
| PIGSTY 0.5.1 d12.x86_64.pg14 : postgresql-14-pgmqtt postgresql-14-pgmqtt_0.5.1-1PGSTY~bookworm_amd64.deb
|
| d12.aarch64 | PIGSTY 0.5.1 d12.aarch64.pg18 : postgresql-18-pgmqtt postgresql-18-pgmqtt_0.5.1-1PGSTY~bookworm_arm64.deb
| PIGSTY 0.5.1 d12.aarch64.pg17 : postgresql-17-pgmqtt postgresql-17-pgmqtt_0.5.1-1PGSTY~bookworm_arm64.deb
| PIGSTY 0.5.1 d12.aarch64.pg16 : postgresql-16-pgmqtt postgresql-16-pgmqtt_0.5.1-1PGSTY~bookworm_arm64.deb
| PIGSTY 0.5.1 d12.aarch64.pg15 : postgresql-15-pgmqtt postgresql-15-pgmqtt_0.5.1-1PGSTY~bookworm_arm64.deb
| PIGSTY 0.5.1 d12.aarch64.pg14 : postgresql-14-pgmqtt postgresql-14-pgmqtt_0.5.1-1PGSTY~bookworm_arm64.deb
|
| d13.x86_64 | PIGSTY 0.5.1 d13.x86_64.pg18 : postgresql-18-pgmqtt postgresql-18-pgmqtt_0.5.1-1PGSTY~trixie_amd64.deb
| PIGSTY 0.5.1 d13.x86_64.pg17 : postgresql-17-pgmqtt postgresql-17-pgmqtt_0.5.1-1PGSTY~trixie_amd64.deb
| PIGSTY 0.5.1 d13.x86_64.pg16 : postgresql-16-pgmqtt postgresql-16-pgmqtt_0.5.1-1PGSTY~trixie_amd64.deb
| PIGSTY 0.5.1 d13.x86_64.pg15 : postgresql-15-pgmqtt postgresql-15-pgmqtt_0.5.1-1PGSTY~trixie_amd64.deb
| PIGSTY 0.5.1 d13.x86_64.pg14 : postgresql-14-pgmqtt postgresql-14-pgmqtt_0.5.1-1PGSTY~trixie_amd64.deb
|
| d13.aarch64 | PIGSTY 0.5.1 d13.aarch64.pg18 : postgresql-18-pgmqtt postgresql-18-pgmqtt_0.5.1-1PGSTY~trixie_arm64.deb
| PIGSTY 0.5.1 d13.aarch64.pg17 : postgresql-17-pgmqtt postgresql-17-pgmqtt_0.5.1-1PGSTY~trixie_arm64.deb
| PIGSTY 0.5.1 d13.aarch64.pg16 : postgresql-16-pgmqtt postgresql-16-pgmqtt_0.5.1-1PGSTY~trixie_arm64.deb
| PIGSTY 0.5.1 d13.aarch64.pg15 : postgresql-15-pgmqtt postgresql-15-pgmqtt_0.5.1-1PGSTY~trixie_arm64.deb
| PIGSTY 0.5.1 d13.aarch64.pg14 : postgresql-14-pgmqtt postgresql-14-pgmqtt_0.5.1-1PGSTY~trixie_arm64.deb
|
| u22.x86_64 | PIGSTY 0.5.1 u22.x86_64.pg18 : postgresql-18-pgmqtt postgresql-18-pgmqtt_0.5.1-1PGSTY~jammy_amd64.deb
| PIGSTY 0.5.1 u22.x86_64.pg17 : postgresql-17-pgmqtt postgresql-17-pgmqtt_0.5.1-1PGSTY~jammy_amd64.deb
| PIGSTY 0.5.1 u22.x86_64.pg16 : postgresql-16-pgmqtt postgresql-16-pgmqtt_0.5.1-1PGSTY~jammy_amd64.deb
| PIGSTY 0.5.1 u22.x86_64.pg15 : postgresql-15-pgmqtt postgresql-15-pgmqtt_0.5.1-1PGSTY~jammy_amd64.deb
| PIGSTY 0.5.1 u22.x86_64.pg14 : postgresql-14-pgmqtt postgresql-14-pgmqtt_0.5.1-1PGSTY~jammy_amd64.deb
|
| u22.aarch64 | PIGSTY 0.5.1 u22.aarch64.pg18 : postgresql-18-pgmqtt postgresql-18-pgmqtt_0.5.1-1PGSTY~jammy_arm64.deb
| PIGSTY 0.5.1 u22.aarch64.pg17 : postgresql-17-pgmqtt postgresql-17-pgmqtt_0.5.1-1PGSTY~jammy_arm64.deb
| PIGSTY 0.5.1 u22.aarch64.pg16 : postgresql-16-pgmqtt postgresql-16-pgmqtt_0.5.1-1PGSTY~jammy_arm64.deb
| PIGSTY 0.5.1 u22.aarch64.pg15 : postgresql-15-pgmqtt postgresql-15-pgmqtt_0.5.1-1PGSTY~jammy_arm64.deb
| PIGSTY 0.5.1 u22.aarch64.pg14 : postgresql-14-pgmqtt postgresql-14-pgmqtt_0.5.1-1PGSTY~jammy_arm64.deb
|
| u24.x86_64 | PIGSTY 0.5.1 u24.x86_64.pg18 : postgresql-18-pgmqtt postgresql-18-pgmqtt_0.5.1-1PGSTY~noble_amd64.deb
| PIGSTY 0.5.1 u24.x86_64.pg17 : postgresql-17-pgmqtt postgresql-17-pgmqtt_0.5.1-1PGSTY~noble_amd64.deb
| PIGSTY 0.5.1 u24.x86_64.pg16 : postgresql-16-pgmqtt postgresql-16-pgmqtt_0.5.1-1PGSTY~noble_amd64.deb
| PIGSTY 0.5.1 u24.x86_64.pg15 : postgresql-15-pgmqtt postgresql-15-pgmqtt_0.5.1-1PGSTY~noble_amd64.deb
| PIGSTY 0.5.1 u24.x86_64.pg14 : postgresql-14-pgmqtt postgresql-14-pgmqtt_0.5.1-1PGSTY~noble_amd64.deb
|
| u24.aarch64 | PIGSTY 0.5.1 u24.aarch64.pg18 : postgresql-18-pgmqtt postgresql-18-pgmqtt_0.5.1-1PGSTY~noble_arm64.deb
| PIGSTY 0.5.1 u24.aarch64.pg17 : postgresql-17-pgmqtt postgresql-17-pgmqtt_0.5.1-1PGSTY~noble_arm64.deb
| PIGSTY 0.5.1 u24.aarch64.pg16 : postgresql-16-pgmqtt postgresql-16-pgmqtt_0.5.1-1PGSTY~noble_arm64.deb
| PIGSTY 0.5.1 u24.aarch64.pg15 : postgresql-15-pgmqtt postgresql-15-pgmqtt_0.5.1-1PGSTY~noble_arm64.deb
| PIGSTY 0.5.1 u24.aarch64.pg14 : postgresql-14-pgmqtt postgresql-14-pgmqtt_0.5.1-1PGSTY~noble_arm64.deb
|
| u26.x86_64 | PIGSTY 0.5.1 u26.x86_64.pg18 : postgresql-18-pgmqtt postgresql-18-pgmqtt_0.5.1-1PGSTY~resolute_amd64.deb
| PIGSTY 0.5.1 u26.x86_64.pg17 : postgresql-17-pgmqtt postgresql-17-pgmqtt_0.5.1-1PGSTY~resolute_amd64.deb
| PIGSTY 0.5.1 u26.x86_64.pg16 : postgresql-16-pgmqtt postgresql-16-pgmqtt_0.5.1-1PGSTY~resolute_amd64.deb
| PIGSTY 0.5.1 u26.x86_64.pg15 : postgresql-15-pgmqtt postgresql-15-pgmqtt_0.5.1-1PGSTY~resolute_amd64.deb
| PIGSTY 0.5.1 u26.x86_64.pg14 : postgresql-14-pgmqtt postgresql-14-pgmqtt_0.5.1-1PGSTY~resolute_amd64.deb
|
| u26.aarch64 | PIGSTY 0.5.1 u26.aarch64.pg18 : postgresql-18-pgmqtt postgresql-18-pgmqtt_0.5.1-1PGSTY~resolute_arm64.deb
| PIGSTY 0.5.1 u26.aarch64.pg17 : postgresql-17-pgmqtt postgresql-17-pgmqtt_0.5.1-1PGSTY~resolute_arm64.deb
| PIGSTY 0.5.1 u26.aarch64.pg16 : postgresql-16-pgmqtt postgresql-16-pgmqtt_0.5.1-1PGSTY~resolute_arm64.deb
| PIGSTY 0.5.1 u26.aarch64.pg15 : postgresql-15-pgmqtt postgresql-15-pgmqtt_0.5.1-1PGSTY~resolute_arm64.deb
| PIGSTY 0.5.1 u26.aarch64.pg14 : postgresql-14-pgmqtt postgresql-14-pgmqtt_0.5.1-1PGSTY~resolute_arm64.deb
|
Build
You can build the RPM / DEB packages for pgmqtt using pig build:
Install
You can install pgmqtt directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Preload:
Create Extension:
Usage
Sources:
- pgmqtt 0.5.1 README
- pgmqtt 0.5.1 interfaces
- pgmqtt 0.5.1 configuration
- pgmqtt 0.5.1 limitations
- pgmqtt 0.5.1 release notes
pgmqtt embeds an MQTT broker in PostgreSQL. It can publish INSERT, UPDATE, and DELETE changes through logical decoding and can map inbound MQTT topics and JSON payloads to table writes. Use it when database and MQTT integration justify running a network broker inside the PostgreSQL server process.
Preload and Create the Extension
Set logical WAL and preload the worker, then restart PostgreSQL:
wal_level = logical
shared_preload_libraries = 'pgmqtt'
pgmqtt.database = 'postgres'
After restart, connect to the database named by pgmqtt.database (postgres by default) and create the extension there. Its worker tables, mappings, and logical slot belong to that configured database; create the mapped application tables there too:
CREATE EXTENSION pgmqtt;
Listener addresses, ports, authentication, and TLS settings are read by the background worker. Settings documented as startup-only require a worker/server restart, not just pg_reload_conf().
Publish Table Changes
Create an outbound mapping:
SELECT pgmqtt_add_outbound_mapping(
'public',
'orders',
'orders/{{ op | lower }}',
'{{ columns | tojson }}',
1
);
The mapping publishes row changes to topics such as orders/insert. The interface also accepts a QoS and template type where supported. Version 0.5.1 drains CDC changes in batches of up to 4096 records.
Inspect or remove outbound mappings:
SELECT * FROM pgmqtt_list_outbound_mappings();
SELECT pgmqtt_remove_outbound_mapping('public', 'orders');
Write Rows from MQTT
Map captured topic segments and JSON fields to a target table:
SELECT pgmqtt_add_inbound_mapping(
'sensor/{site_id}/temperature',
'sensor_readings',
'{"site_id":"{site_id}","value":"$.temperature"}'::jsonb,
mapping_name => 'temp_readings'
);
Inbound mappings support insert and documented upsert/delete modes with options such as target_schema, conflict_columns, mapping_name, and template_type. Grant the worker role only the required table privileges and validate payload types and constraints.
SELECT * FROM pgmqtt_list_inbound_mappings();
SELECT pgmqtt_remove_inbound_mapping('temp_readings');
Administration and Status
SELECT * FROM pgmqtt_status();
SELECT pgmqtt_disconnect_client('device-42');
SELECT pgmqtt_disconnect_role('mqtt_devices');
SELECT pgmqtt_reload_acls('*');
pgmqtt_status reports listener, client, subscription, retained-message, CDC, inbound-write, and dead-letter state. Administrative calls are queued for asynchronous processing by the worker.
Configuration Index
- pgmqtt.mqtt_enabled and pgmqtt.mqtt_port: TCP MQTT listener.
- pgmqtt.ws_enabled and pgmqtt.ws_port: WebSocket listener.
- pgmqtt.tick_interval_ms and pgmqtt.cdc_every_n_ticks: worker cadence.
- pgmqtt.max_client_buffer_bytes: per-client flow-control boundary.
- pgmqtt.debug_log and pgmqtt.metrics_*: diagnostics and metrics integration.
- pgmqtt TLS, JWT, password-authentication, and ACL settings: transport and client access controls; availability differs between community and enterprise features.
Protocol and CDC Boundaries
- MQTT 5.0 and 3.1.1 are supported. QoS 0 and 1 are implemented; requested QoS 2 is downgraded to QoS 1.
- CDC covers INSERT, UPDATE, and DELETE, not DDL or TRUNCATE. DELETE payloads may require REPLICA IDENTITY FULL.
- The CDC ring has a finite capacity of 8192 and drops the oldest records on overflow. The QoS 0 topic buffer is capped at 4096 and also drops oldest entries; the per-client pending queue disconnects clients above 50,000 messages.
- The community edition documents TLS through a proxy, while native TLS and some JWT features are enterprise boundaries. Verify the edition before setting listener expectations.
Version 0.5.1 and Operations
Version 0.5.1 publishes tested upstream artifacts for PostgreSQL 15–18. Some server builds expose output_plugin_libraries and reject unlisted logical decoding plugins. If the worker reports that pgmqtt may not be used as an output plugin, follow the release instructions to add it to that build’s allowlist and reload configuration. Do not add this setting to a server that does not provide it.
The optional enterprise multiprocess topology also requires pgmqtt.experimental_multiprocess at startup and a full restart when changed. It introduces a separate CDC worker and a table-backed outbox; it does not remove the documented overflow limits of every other message path. All pgmqtt GUCs require superuser access.
Running a broker inside PostgreSQL expands the database network and resource boundary. Isolate listener interfaces, enforce authentication and topic ACLs, monitor worker lag and dropped buffers, and test failover and restart behavior before production use.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)