omni_httpd

Omnigres HTTP服务器

概览

扩展包名版本分类许可证语言
omnigres0.4.11FEATApache-2.0C
ID扩展名BinLibLoadCreateTrustReloc模式
2940omniomni
2941omni_authomni_auth
2942omni_awsomni_aws
2943omni_cloudeventsomni_cloudevents
2944omni_containersomni_containers
2945omni_credentialsomni_credentials
2948omni_emailomni_email
2949omni_httpomni_http
2950omni_httpcomni_httpc
2951omni_httpdomni_httpd
2952omni_id-
2953omni_jsonomni_json
2954omni_kubeomni_kube
2955omni_ledgeromni_ledger
2956omni_manifestomni_manifest
2957omni_mimetypesomni_mimetypes
2958omni_osomni_os
2959omni_polyfillomni_polyfill
2960omni_pythonomni_python
2961omni_regex-
2962omni_restomni_rest
2963omni_schemaomni_schema
2964omni_seqomni_seq
2965omni_serviceomni_service
2966omni_sessionomni_session
2968omni_sqlomni_sql
2969omni_sqliteomni_sqlite
2970omni_testomni_test
2971omni_txnomni_txn
2972omni_typesomni_types
2973omni_varomni_var
2974omni_vfsomni_vfs
2975omni_vfs_types_v1omni_vfs_types_v1
2976omni_webomni_web
2977omni_workeromni_worker
2978omni_xmlomni_xml
2979omni_yamlomni_yaml
相关扩展omni_types omni_http
下游依赖omni_rest omni_session

版本

类型仓库版本PG 大版本包名依赖
EXTPIGSTY0.4.111817161514omnigresomni_types, omni_http
RPMPIGSTY0.4.111817161514omnigres_$v-
DEBPIGSTY0.4.111817161514postgresql-$v-omnigres-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64PIGSTY MISSPIGSTY 20250120PIGSTY 20250120PIGSTY 20250120PIGSTY 20250120
el8.aarch64PIGSTY MISSPIGSTY 20250120PIGSTY 20250120PIGSTY 20250120PIGSTY 20250120
el9.x86_64PIGSTY MISSPIGSTY 20250507PIGSTY 20250507PIGSTY 20250507PIGSTY 20250507
el9.aarch64PIGSTY MISSPIGSTY 20250507PIGSTY 20250507PIGSTY 20250507PIGSTY 20250507
el10.x86_64PIGSTY MISSPIGSTY MISSPIGSTY MISSPIGSTY MISSPIGSTY MISS
el10.aarch64PIGSTY MISSPIGSTY MISSPIGSTY MISSPIGSTY MISSPIGSTY MISS
d12.x86_64PIGSTY MISSPIGSTY 20250120PIGSTY 20250120PIGSTY 20250120PIGSTY 20250120
d12.aarch64PIGSTY MISSPIGSTY 20250120PIGSTY 20250120PIGSTY 20250120PIGSTY 20250120
d13.x86_64PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108
d13.aarch64PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108
u22.x86_64PIGSTY MISSPIGSTY 20250120PIGSTY 20250120PIGSTY 20250120PIGSTY 20250120
u22.aarch64PIGSTY MISSPIGSTY 20250120PIGSTY 20250120PIGSTY 20250120PIGSTY 20250120
u24.x86_64PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108
u24.aarch64PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108PIGSTY 20251108

构建

您可以使用 pig build 命令构建 omnigres 扩展的 RPM / DEB 包:

pig build pkg omnigres         # 构建 RPM / DEB 包

安装

您可以直接安装 omnigres 扩展包的预置二进制包,首先确保 PGDGPIGSTY 仓库已经添加并启用:

pig repo add pgsql -u          # 添加仓库并更新缓存

使用 pig 或者是 apt/yum/dnf 安装扩展:

pig install omnigres;          # 当前活跃 PG 版本安装
pig ext install -y omnigres -v 18  # PG 18
pig ext install -y omnigres -v 17  # PG 17
pig ext install -y omnigres -v 16  # PG 16
pig ext install -y omnigres -v 15  # PG 15
pig ext install -y omnigres -v 14  # PG 14
dnf install -y omnigres_18       # PG 18
dnf install -y omnigres_17       # PG 17
dnf install -y omnigres_16       # PG 16
dnf install -y omnigres_15       # PG 15
dnf install -y omnigres_14       # PG 14
apt install -y postgresql-18-omnigres   # PG 18
apt install -y postgresql-17-omnigres   # PG 17
apt install -y postgresql-16-omnigres   # PG 16
apt install -y postgresql-15-omnigres   # PG 15
apt install -y postgresql-14-omnigres   # PG 14

创建扩展

CREATE EXTENSION omni_httpd CASCADE;  -- 依赖: omni_types, omni_http

用法

omni_httpd: HTTP 服务器

omni_httpd 扩展是 PostgreSQL 的内嵌 HTTP 服务器,允许在 SQL 中处理 HTTP 请求。

定义处理器

CREATE FUNCTION my_handler(request omni_httpd.http_request)
    RETURNS omni_httpd.http_outcome
    RETURN omni_httpd.http_response(body => request.headers::text);

注册路由

INSERT INTO omni_httpd.urlpattern_router (match, handler)
VALUES (omni_httpd.urlpattern('/headers'), 'my_handler'::regproc);

配置

  • omni_httpd.http_workers – HTTP 工作进程数(默认为 CPU 数量,受 max_worker_processes 限制)
  • omni_httpd.temp_dir – 套接字临时目录(默认 /tmp

控制

SELECT omni_httpd.stop();   -- 停止服务器
SELECT omni_httpd.start();  -- 启动服务器
-- 传入 immediate => true 可立即执行而无需等待事务提交

主要类型

  • omni_httpd.http_request – 请求类型,包含 pathmethodquery_stringheadersbody
  • omni_httpd.http_response – 响应构造器
  • omni_httpd.http_outcome – 处理器返回类型

最后修改 2026-03-14: update extension metadata (953cbd0)