omni_aws

Omnigres AWS S3 API封装

概览

扩展包名版本分类许可证语言
omnigres0.1.2FEATApache-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_httpc pgcrypto omni_xml omni_web

版本

类型仓库版本PG 大版本包名依赖
EXTPIGSTY0.1.21817161514omnigresomni_httpc, pgcrypto, omni_xml, omni_web
RPMPIGSTY0.1.21817161514omnigres_$v-
DEBPIGSTY0.1.21817161514postgresql-$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_aws CASCADE;  -- 依赖: omni_httpc, pgcrypto, omni_xml, omni_web

用法

omni_aws: Amazon Web Services API(S3)

omni_aws 扩展为 PostgreSQL 提供 S3 兼容的 API 函数。

S3 API 函数

s3_create_bucket(bucket, region) – 创建 S3 存储桶。

s3_list_objects_v2(bucket, path, continuation_token, delimiter, encoding_type, fetch_owner, max_keys, start_after, region) – 列出存储桶中的对象,支持分页。

s3_put_object(bucket, path, payload, content_type, region) – 上传对象。默认内容类型为 application/octet-stream

执行

单个请求:

SELECT * FROM omni_aws.aws_execute(
    access_key_id => 'AKID',
    secret_access_key => 'SECRET',
    request => omni_aws.s3_put_object('my-bucket', '/path/to/file', 'content'::bytea)
);

批量请求:requests 作为数组传入以实现高效批量操作。返回带 error 列的表。

预签名 URL

SELECT omni_aws.s3_presigned_url(
    bucket => 'my-bucket',
    path => '/my-file',
    access_key_id => 'AKID',
    secret_access_key => 'SECRET',
    expires => 604800,  -- 7 天(默认)
    region => 'us-east-1'
);

自定义端点

  • DigitalOcean Spaces: digitalocean_s3_endpoint()
  • 通用端点: s3_endpoint(url),支持 ${region}${bucket} 变量,适用于 MinIO 等兼容服务

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