pg_react
pg-react · Reactive SQL rules with durable work and database-local consequences.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 102366 | pg_react | pg-react | 0.46.2 | FEAT | Apache-2.0 | Rust |
PostgreSQL · 18
| Relationships | |
|---|---|
| Requires | pg_trickle |
Usage
Sources:
- Official source
- Official source
- Official source
- Official source
- Official source
- Official source
- Official source
- Official source
pg_react turns relational conditions into durable rule work. The source SQL default is 0.46.2, while the officially qualified learning profile remains pg_react 0.46.0, pg_trickle 0.108.0, PostgreSQL 18.3 and Linux amd64. Cargo version 0.48.0 and the optional synthetic MDM adapter do not establish a newer qualified deployment.
Prepare and inspect
Preload pg_trickle and pg_react in that order and restart. Use the installation guide’s trigger CDC and disabled pg_trickle scheduler settings, and configure managed workers for each database with a suitable execution role. Installing SQL objects does not alone start a working deployment.
Rule workflow
Create an application view whose rows represent a condition and choose a stable semantic key. Construct pgreact.rule(), validate it, preview it, inspect findings and deploy with the reviewed token. CONSTRAINT records matches; COMMAND requires a typed consequence function. The following minimal declaration assumes the view and its order_id key already exist.
Execution boundary
Validation does not deploy the rule. Review tokens bind a plan and state but grant no permissions. Default bootstrap seeds existing matches without treating them as new work. Commit source changes so workers can observe them; pgreact.run() coordinates work rather than waiting for every consequence to finish. Database-local effects share the bookkeeping transaction; external outbox delivery is at least once and requires deduplication. Inspect pgreact.attempts and operations guidance before retries or removals.