pg_durable
pg_durable : Durable SQL functions for PostgreSQL
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 2870 | pg_durable | pg_durable | 0.2.3 |
FEAT | PostgreSQL | Rust |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-- | No | Yes | Yes | Yes | no | no |
| Relationships | |
|---|---|
| Schemas | df duroxide |
| See Also | pg_task pgmq pg_background ulak pgmb pg_later pg_dispatch pg_retry fsm_core pglock |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.2.3 |
18 17 16 15 14 | pg_durable |
- |
| RPM | PIGSTY | 0.2.3 |
18 17 16 15 14 | pg_durable_$v |
- |
| DEB | PIGSTY | 0.2.3 |
18 17 16 15 14 | postgresql-$v-pg-durable |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| el8.aarch64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| el9.x86_64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| el9.aarch64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| el10.x86_64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| el10.aarch64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| d12.x86_64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| d12.aarch64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| d13.x86_64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| d13.aarch64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| u22.x86_64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| u22.aarch64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| u24.x86_64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| u24.aarch64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| u26.x86_64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
| u26.aarch64 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 | PIGSTY 0.2.3 |
Source
github.com/microsoft/pg_durable
pg_durable-0.2.3.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
Usage
Sources:
pg_durable runs durable, fault-tolerant SQL workflows inside PostgreSQL. A workflow is a graph of SQL steps, timers, signals, conditions, and parallel branches submitted with df.start(). Execution state is checkpointed in PostgreSQL so completed steps are not repeated after a crash, restart, or retry.
Enable and Grant Access
Preload the worker, select its database and superuser role if the defaults are unsuitable, then restart PostgreSQL:
Create the extension in pg_durable.database and grant an application login role access:
The worker role must be a superuser because it manages all users’ instances while bypassing row-level security. The role that calls df.start() must have LOGIN, because workflow SQL is executed through a connection authenticated as that captured role.
Build and Run a Workflow
df.start() returns an instance ID. Use it to monitor or control the run:
DSL Index
~>sequences steps;|=>names a result for$name,$name.column, or$name.*substitution.&/df.join()waits for parallel branches;|/df.race()keeps the first result.?>and!>/df.if()select conditional branches;@>/df.loop()repeats a graph.df.sleep(),df.wait_for_schedule(), anddf.wait_for_signal()make waits durable.df.signal(),df.wait_for_completion(),df.explain(), and the instance-inspection functions operate on running or stored instances.df.setvar(),df.getvar(),df.unsetvar(), anddf.clearvars()manage per-user variables captured whendf.start()is called.
Version 0.2.3 Boundaries
- Fresh v0.2.3 installs place provider objects in
_duroxide; installations upgraded from 0.2.2 or earlier keepduroxide.df.duroxide_schema()reports the active schema. - Graphs deeper than 256 levels or larger than 10,000 nodes are rejected. A condition query returning no rows evaluates as false.
- Re-run
df.grant_usage()afterALTER EXTENSION ... UPDATE, because grants on all functions do not automatically include functions added later. - Variable
{name}substitution is raw SQL text substitution; never place untrusted input in such variables. Named step-result substitution through$nameperforms SQL escaping. df.http()availability and egress policy are compile-time features. Its restrictions do not sandbox arbitrary SQL or other installed extensions.- Upstream labels the project preview, and the published v0.2.3 Docker images are for evaluation and learning rather than production.