pg_durable
在 PostgreSQL 中使用 SQL 定义可持久化、可恢复的长时间运行函数
仓库
microsoft/pg_durable
https://github.com/microsoft/pg_durable
源码
pg_durable-0.2.8.tar.gz
pg_durable-0.2.8.tar.gz
概览
| 扩展包名 | 版本 | 分类 | 许可证 | 语言 |
|---|---|---|---|---|
pg_durable | 0.2.8 | FEAT | PostgreSQL | Rust |
| ID | 扩展名 | Bin | Lib | Load | Create | Trust | Reloc | 模式 |
|---|---|---|---|---|---|---|---|---|
| 2870 | pg_durable | 否 | 是 | 是 | 是 | 否 | 否 | pg_catalog |
Requires preload and a superuser worker role; pgrx 0.19.2.
版本
| 类型 | 仓库 | 版本 | PG 大版本 | 包名 | 依赖 |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.2.8 | 1817161514 | pg_durable | - |
| RPM | PIGSTY | 0.2.8 | 1817161514 | pg_durable_$v | - |
| DEB | PIGSTY | 0.2.8 | 1817161514 | postgresql-$v-pg-durable | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 0.2.8 el8.x86_64.pg18 : pg_durable_18 pg_durable_18-0.2.8-1PGSTY.el8.x86_64.rpm
| PIGSTY 0.2.8 el8.x86_64.pg17 : pg_durable_17 pg_durable_17-0.2.8-1PGSTY.el8.x86_64.rpm
| PIGSTY 0.2.8 el8.x86_64.pg16 : pg_durable_16 pg_durable_16-0.2.8-1PGSTY.el8.x86_64.rpm
| PIGSTY 0.2.8 el8.x86_64.pg15 : pg_durable_15 pg_durable_15-0.2.8-1PGSTY.el8.x86_64.rpm
| PIGSTY 0.2.8 el8.x86_64.pg14 : pg_durable_14 pg_durable_14-0.2.8-1PGSTY.el8.x86_64.rpm
|
| el8.aarch64 | PIGSTY 0.2.8 el8.aarch64.pg18 : pg_durable_18 pg_durable_18-0.2.8-1PGSTY.el8.aarch64.rpm
| PIGSTY 0.2.8 el8.aarch64.pg17 : pg_durable_17 pg_durable_17-0.2.8-1PGSTY.el8.aarch64.rpm
| PIGSTY 0.2.8 el8.aarch64.pg16 : pg_durable_16 pg_durable_16-0.2.8-1PGSTY.el8.aarch64.rpm
| PIGSTY 0.2.8 el8.aarch64.pg15 : pg_durable_15 pg_durable_15-0.2.8-1PGSTY.el8.aarch64.rpm
| PIGSTY 0.2.8 el8.aarch64.pg14 : pg_durable_14 pg_durable_14-0.2.8-1PGSTY.el8.aarch64.rpm
|
| el9.x86_64 | PIGSTY 0.2.8 el9.x86_64.pg18 : pg_durable_18 pg_durable_18-0.2.8-1PGSTY.el9.x86_64.rpm
| PIGSTY 0.2.8 el9.x86_64.pg17 : pg_durable_17 pg_durable_17-0.2.8-1PGSTY.el9.x86_64.rpm
| PIGSTY 0.2.8 el9.x86_64.pg16 : pg_durable_16 pg_durable_16-0.2.8-1PGSTY.el9.x86_64.rpm
| PIGSTY 0.2.8 el9.x86_64.pg15 : pg_durable_15 pg_durable_15-0.2.8-1PGSTY.el9.x86_64.rpm
| PIGSTY 0.2.8 el9.x86_64.pg14 : pg_durable_14 pg_durable_14-0.2.8-1PGSTY.el9.x86_64.rpm
|
| el9.aarch64 | PIGSTY 0.2.8 el9.aarch64.pg18 : pg_durable_18 pg_durable_18-0.2.8-1PGSTY.el9.aarch64.rpm
| PIGSTY 0.2.8 el9.aarch64.pg17 : pg_durable_17 pg_durable_17-0.2.8-1PGSTY.el9.aarch64.rpm
| PIGSTY 0.2.8 el9.aarch64.pg16 : pg_durable_16 pg_durable_16-0.2.8-1PGSTY.el9.aarch64.rpm
| PIGSTY 0.2.8 el9.aarch64.pg15 : pg_durable_15 pg_durable_15-0.2.8-1PGSTY.el9.aarch64.rpm
| PIGSTY 0.2.8 el9.aarch64.pg14 : pg_durable_14 pg_durable_14-0.2.8-1PGSTY.el9.aarch64.rpm
|
| el10.x86_64 | PIGSTY 0.2.8 el10.x86_64.pg18 : pg_durable_18 pg_durable_18-0.2.8-1PGSTY.el10.x86_64.rpm
| PIGSTY 0.2.8 el10.x86_64.pg17 : pg_durable_17 pg_durable_17-0.2.8-1PGSTY.el10.x86_64.rpm
| PIGSTY 0.2.8 el10.x86_64.pg16 : pg_durable_16 pg_durable_16-0.2.8-1PGSTY.el10.x86_64.rpm
| PIGSTY 0.2.8 el10.x86_64.pg15 : pg_durable_15 pg_durable_15-0.2.8-1PGSTY.el10.x86_64.rpm
| PIGSTY 0.2.8 el10.x86_64.pg14 : pg_durable_14 pg_durable_14-0.2.8-1PGSTY.el10.x86_64.rpm
|
| el10.aarch64 | PIGSTY 0.2.8 el10.aarch64.pg18 : pg_durable_18 pg_durable_18-0.2.8-1PGSTY.el10.aarch64.rpm
| PIGSTY 0.2.8 el10.aarch64.pg17 : pg_durable_17 pg_durable_17-0.2.8-1PGSTY.el10.aarch64.rpm
| PIGSTY 0.2.8 el10.aarch64.pg16 : pg_durable_16 pg_durable_16-0.2.8-1PGSTY.el10.aarch64.rpm
| PIGSTY 0.2.8 el10.aarch64.pg15 : pg_durable_15 pg_durable_15-0.2.8-1PGSTY.el10.aarch64.rpm
| PIGSTY 0.2.8 el10.aarch64.pg14 : pg_durable_14 pg_durable_14-0.2.8-1PGSTY.el10.aarch64.rpm
|
| d12.x86_64 | PIGSTY 0.2.8 d12.x86_64.pg18 : postgresql-18-pg-durable postgresql-18-pg-durable_0.2.8-1PGSTY~bookworm_amd64.deb
| PIGSTY 0.2.8 d12.x86_64.pg17 : postgresql-17-pg-durable postgresql-17-pg-durable_0.2.8-1PGSTY~bookworm_amd64.deb
| PIGSTY 0.2.8 d12.x86_64.pg16 : postgresql-16-pg-durable postgresql-16-pg-durable_0.2.8-1PGSTY~bookworm_amd64.deb
| PIGSTY 0.2.8 d12.x86_64.pg15 : postgresql-15-pg-durable postgresql-15-pg-durable_0.2.8-1PGSTY~bookworm_amd64.deb
| PIGSTY 0.2.8 d12.x86_64.pg14 : postgresql-14-pg-durable postgresql-14-pg-durable_0.2.8-1PGSTY~bookworm_amd64.deb
|
| d12.aarch64 | PIGSTY 0.2.8 d12.aarch64.pg18 : postgresql-18-pg-durable postgresql-18-pg-durable_0.2.8-1PGSTY~bookworm_arm64.deb
| PIGSTY 0.2.8 d12.aarch64.pg17 : postgresql-17-pg-durable postgresql-17-pg-durable_0.2.8-1PGSTY~bookworm_arm64.deb
| PIGSTY 0.2.8 d12.aarch64.pg16 : postgresql-16-pg-durable postgresql-16-pg-durable_0.2.8-1PGSTY~bookworm_arm64.deb
| PIGSTY 0.2.8 d12.aarch64.pg15 : postgresql-15-pg-durable postgresql-15-pg-durable_0.2.8-1PGSTY~bookworm_arm64.deb
| PIGSTY 0.2.8 d12.aarch64.pg14 : postgresql-14-pg-durable postgresql-14-pg-durable_0.2.8-1PGSTY~bookworm_arm64.deb
|
| d13.x86_64 | PIGSTY 0.2.8 d13.x86_64.pg18 : postgresql-18-pg-durable postgresql-18-pg-durable_0.2.8-1PGSTY~trixie_amd64.deb
| PIGSTY 0.2.8 d13.x86_64.pg17 : postgresql-17-pg-durable postgresql-17-pg-durable_0.2.8-1PGSTY~trixie_amd64.deb
| PIGSTY 0.2.8 d13.x86_64.pg16 : postgresql-16-pg-durable postgresql-16-pg-durable_0.2.8-1PGSTY~trixie_amd64.deb
| PIGSTY 0.2.8 d13.x86_64.pg15 : postgresql-15-pg-durable postgresql-15-pg-durable_0.2.8-1PGSTY~trixie_amd64.deb
| PIGSTY 0.2.8 d13.x86_64.pg14 : postgresql-14-pg-durable postgresql-14-pg-durable_0.2.8-1PGSTY~trixie_amd64.deb
|
| d13.aarch64 | PIGSTY 0.2.8 d13.aarch64.pg18 : postgresql-18-pg-durable postgresql-18-pg-durable_0.2.8-1PGSTY~trixie_arm64.deb
| PIGSTY 0.2.8 d13.aarch64.pg17 : postgresql-17-pg-durable postgresql-17-pg-durable_0.2.8-1PGSTY~trixie_arm64.deb
| PIGSTY 0.2.8 d13.aarch64.pg16 : postgresql-16-pg-durable postgresql-16-pg-durable_0.2.8-1PGSTY~trixie_arm64.deb
| PIGSTY 0.2.8 d13.aarch64.pg15 : postgresql-15-pg-durable postgresql-15-pg-durable_0.2.8-1PGSTY~trixie_arm64.deb
| PIGSTY 0.2.8 d13.aarch64.pg14 : postgresql-14-pg-durable postgresql-14-pg-durable_0.2.8-1PGSTY~trixie_arm64.deb
|
| u22.x86_64 | PIGSTY 0.2.8 u22.x86_64.pg18 : postgresql-18-pg-durable postgresql-18-pg-durable_0.2.8-1PGSTY~jammy_amd64.deb
| PIGSTY 0.2.8 u22.x86_64.pg17 : postgresql-17-pg-durable postgresql-17-pg-durable_0.2.8-1PGSTY~jammy_amd64.deb
| PIGSTY 0.2.8 u22.x86_64.pg16 : postgresql-16-pg-durable postgresql-16-pg-durable_0.2.8-1PGSTY~jammy_amd64.deb
| PIGSTY 0.2.8 u22.x86_64.pg15 : postgresql-15-pg-durable postgresql-15-pg-durable_0.2.8-1PGSTY~jammy_amd64.deb
| PIGSTY 0.2.8 u22.x86_64.pg14 : postgresql-14-pg-durable postgresql-14-pg-durable_0.2.8-1PGSTY~jammy_amd64.deb
|
| u22.aarch64 | PIGSTY 0.2.8 u22.aarch64.pg18 : postgresql-18-pg-durable postgresql-18-pg-durable_0.2.8-1PGSTY~jammy_arm64.deb
| PIGSTY 0.2.8 u22.aarch64.pg17 : postgresql-17-pg-durable postgresql-17-pg-durable_0.2.8-1PGSTY~jammy_arm64.deb
| PIGSTY 0.2.8 u22.aarch64.pg16 : postgresql-16-pg-durable postgresql-16-pg-durable_0.2.8-1PGSTY~jammy_arm64.deb
| PIGSTY 0.2.8 u22.aarch64.pg15 : postgresql-15-pg-durable postgresql-15-pg-durable_0.2.8-1PGSTY~jammy_arm64.deb
| PIGSTY 0.2.8 u22.aarch64.pg14 : postgresql-14-pg-durable postgresql-14-pg-durable_0.2.8-1PGSTY~jammy_arm64.deb
|
| u24.x86_64 | PIGSTY 0.2.8 u24.x86_64.pg18 : postgresql-18-pg-durable postgresql-18-pg-durable_0.2.8-1PGSTY~noble_amd64.deb
| PIGSTY 0.2.8 u24.x86_64.pg17 : postgresql-17-pg-durable postgresql-17-pg-durable_0.2.8-1PGSTY~noble_amd64.deb
| PIGSTY 0.2.8 u24.x86_64.pg16 : postgresql-16-pg-durable postgresql-16-pg-durable_0.2.8-1PGSTY~noble_amd64.deb
| PIGSTY 0.2.8 u24.x86_64.pg15 : postgresql-15-pg-durable postgresql-15-pg-durable_0.2.8-1PGSTY~noble_amd64.deb
| PIGSTY 0.2.8 u24.x86_64.pg14 : postgresql-14-pg-durable postgresql-14-pg-durable_0.2.8-1PGSTY~noble_amd64.deb
|
| u24.aarch64 | PIGSTY 0.2.8 u24.aarch64.pg18 : postgresql-18-pg-durable postgresql-18-pg-durable_0.2.8-1PGSTY~noble_arm64.deb
| PIGSTY 0.2.8 u24.aarch64.pg17 : postgresql-17-pg-durable postgresql-17-pg-durable_0.2.8-1PGSTY~noble_arm64.deb
| PIGSTY 0.2.8 u24.aarch64.pg16 : postgresql-16-pg-durable postgresql-16-pg-durable_0.2.8-1PGSTY~noble_arm64.deb
| PIGSTY 0.2.8 u24.aarch64.pg15 : postgresql-15-pg-durable postgresql-15-pg-durable_0.2.8-1PGSTY~noble_arm64.deb
| PIGSTY 0.2.8 u24.aarch64.pg14 : postgresql-14-pg-durable postgresql-14-pg-durable_0.2.8-1PGSTY~noble_arm64.deb
|
| u26.x86_64 | PIGSTY 0.2.8 u26.x86_64.pg18 : postgresql-18-pg-durable postgresql-18-pg-durable_0.2.8-1PGSTY~resolute_amd64.deb
| PIGSTY 0.2.8 u26.x86_64.pg17 : postgresql-17-pg-durable postgresql-17-pg-durable_0.2.8-1PGSTY~resolute_amd64.deb
| PIGSTY 0.2.8 u26.x86_64.pg16 : postgresql-16-pg-durable postgresql-16-pg-durable_0.2.8-1PGSTY~resolute_amd64.deb
| PIGSTY 0.2.8 u26.x86_64.pg15 : postgresql-15-pg-durable postgresql-15-pg-durable_0.2.8-1PGSTY~resolute_amd64.deb
| PIGSTY 0.2.8 u26.x86_64.pg14 : postgresql-14-pg-durable postgresql-14-pg-durable_0.2.8-1PGSTY~resolute_amd64.deb
|
| u26.aarch64 | PIGSTY 0.2.8 u26.aarch64.pg18 : postgresql-18-pg-durable postgresql-18-pg-durable_0.2.8-1PGSTY~resolute_arm64.deb
| PIGSTY 0.2.8 u26.aarch64.pg17 : postgresql-17-pg-durable postgresql-17-pg-durable_0.2.8-1PGSTY~resolute_arm64.deb
| PIGSTY 0.2.8 u26.aarch64.pg16 : postgresql-16-pg-durable postgresql-16-pg-durable_0.2.8-1PGSTY~resolute_arm64.deb
| PIGSTY 0.2.8 u26.aarch64.pg15 : postgresql-15-pg-durable postgresql-15-pg-durable_0.2.8-1PGSTY~resolute_arm64.deb
| PIGSTY 0.2.8 u26.aarch64.pg14 : postgresql-14-pg-durable postgresql-14-pg-durable_0.2.8-1PGSTY~resolute_arm64.deb
|
构建
您可以使用 pig build 命令构建 pg_durable 扩展的 RPM / DEB 包:
安装
您可以直接安装 pg_durable 扩展包的预置二进制包,首先确保 PGDG 和 PIGSTY 仓库已经添加并启用:
使用 pig 或者是 apt/yum/dnf 安装扩展:
安装
pig
dnf
apt
预加载配置:
创建扩展:
用法
来源:
pg_durable 在PostgreSQL中运行持久、容错的SQL工作流。一个工作流是一系列SQL步骤、定时器、信号、条件和并行分支组成的图,通过df.start()提交。执行状态会在PostgreSQL中进行检查点记录,因此在崩溃、重启或重试后不会重复已完成的步骤。
启用和授权访问
预加载工作进程,如果默认设置不合适,则选择其数据库和超级用户角色,然后重启PostgreSQL:
在pg_durable.database中创建扩展,并授予应用程序登录角色访问权限:
工作进程角色必须是超级用户,因为它会管理所有用户的实例并绕过行级安全。调用df.start()的角色必须具有LOGIN权限,因为工作流SQL是通过该捕获角色认证的连接执行的。
构建和运行一个工作流
df.start()返回实例ID。使用它来监控或控制运行:
DSL索引
~>用于序列化步骤;|=>为$name、$name.column或$name.*替换命名结果。&/df.join()等待并行分支;|/df.race()保留第一个结果。?>和!>/df.if()选择条件分支;@>/df.loop()重复一个图。df.sleep()、df.wait_for_schedule()和df.wait_for_signal()使等待持久化。df.signal()、df.wait_for_completion()、df.explain()及实例检查函数操作正在运行或存储的实例。df.setvar()、df.getvar()、df.unsetvar()和df.clearvars()管理在调用df.start()时捕获的用户变量。
0.2.6 版本边界
- 上游源码安装与发布镜像使用
pgrx0.16.1,支持 PostgreSQL 17 与 18。扩展仍要求shared_preload_libraries、重启以及超级用户工作角色。 - 经由 0.2.4 与 0.2.5 的升级包含会破坏重放的工作流变更。升级前应排空或取消运行中的 JOIN、RACE、循环与
df.wait_for_schedule()工作;0.2.4 的df.nodes键迁移还会获取ACCESS EXCLUSIVE锁。 df.start(..., transaction_mode => 'new')会在调用者事务之外持久化独立启动。集群默认最多并发启动两个,由pg_durable.max_new_transaction_starts与pg_durable.new_transaction_start_timeout控制。- 0.2.6 从左到右只解析一次变量替换,所以变量值引入的令牌形文本不会再次扫描。它仍是原始 SQL 替换;绝不能把不可信输入放进
{name}变量。通过$name的命名步骤结果替换会执行 SQL 转义。 - 未公开的
df.ensure_durofut(text)辅助函数已移除。升级前应删除或改写客户自有的依赖对象。 - 在
ALTER EXTENSION ... UPDATE后重新运行df.grant_usage(),因为对全部函数的授权不会自动覆盖后来新增的函数。 df.http()与df.http_multipart()的可用性和出站策略是编译时特性。其限制不会沙箱化任意 SQL 或其他已安装扩展。- 项目仍处于 1.0 之前,上游发布的 Docker 镜像用于评估与学习,而不是生产。应阅读每个相邻版本的升级警告,不要假设未经测试的跨版本跳跃可安全重放。
这个页面对您有帮助吗?
感谢反馈,我们会据此改进这篇文档。
哪里没有解决?(可选)