pg_automerge
pg_automerge · Automerge CRDT documents with JSONB access, merging and history
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 102197 | pg_automerge | pg_automerge | 0.1.0 | TYPE | MIT | Rust |
PostgreSQL · 18
Usage
Sources:
- README.md
- sql/snapshots/pg_automerge–0.1.0.sql
- docs/src/pages/operations/limitations.mdx
- docs/src/pages/reference/configuration.mdx
- pg_automerge.control
pg_automerge stores Automerge documents as a native PostgreSQL 18 type. Applications create changes and own actor IDs; the extension stores, merges and queries them. It does not edit documents or create changes itself.
Core Workflow
Operational Boundaries
Input must be valid Automerge binary saves, not JSON text. The implicit jsonb cast exposes the current document; merge() and merge_agg() combine histories. Incremental changes require an existing document, so an initial insert must use a full save. Use a distinct actor ID for each writer and compare heads rather than serialized bytes when identifying histories. pg_automerge.max_load_memory limits estimated per-document memory, but allocations bypass PostgreSQL memory accounting and do not bound concurrent sessions. A native load or merge is not promptly interruptible. Installation requires a superuser; keep writers trusted and bound input resource costs.