跳转到主要内容

oai_fdw

通过 HTTP/HTTPS 采集 OAI-PMH 元数据的只读外部数据包装器。

oai_fdw · 通过 HTTP/HTTPS 采集 OAI-PMH 元数据的只读外部数据包装器。

概览

ID扩展软件包版本类别许可证编程语言
8770oai_fdwoai_fdw1.16FDWMITC
属性可执行文件动态库需要预加载需要建扩展可迁移可信
--s-d-r否是否是是否
关联
相关扩展rdf_fdw http postgres_fdw
SQL/control 1.16; package 1.16.0 (tag v1.16). Read-only OAI-PMH 2.0 FDW; libcurl/libxml2; no preload. Response limit has a 1 GB hard ceiling. PG14-18.

软件包

类型仓库版本兼容的 PostgreSQL 大版本包名模式依赖
EXTPIGSTY1.1619 18 17 16 15oai_fdw-
RPMPIGSTY1.16.019 18 17 16 15oai_fdw_$v-
DEBPIGSTY1.16.019 18 17 16 15postgresql-$v-oai-fdw-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
el8.aarch64N/APIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
el9.x86_64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
el9.aarch64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
el10.x86_64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
el10.aarch64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
d12.x86_64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
d12.aarch64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
d13.x86_64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
d13.aarch64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
u22.x86_64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
u22.aarch64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
u24.x86_64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
u24.aarch64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
u26.x86_64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
u26.aarch64PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0PIGSTY 1.16.0
软件包版本平台仓库大小下载
oai_fdw_191.16.0el9.x86_64pigsty117.6 KiBoai_fdw_19-1.16.0-1PGSTY.el9.x86_64.rpm
oai_fdw_191.16.0el9.aarch64pigsty116.0 KiBoai_fdw_19-1.16.0-1PGSTY.el9.aarch64.rpm
oai_fdw_191.16.0el10.x86_64pigsty117.9 KiBoai_fdw_19-1.16.0-1PGSTY.el10.x86_64.rpm
oai_fdw_191.16.0el10.aarch64pigsty116.1 KiBoai_fdw_19-1.16.0-1PGSTY.el10.aarch64.rpm
postgresql-19-oai-fdw1.16.0d12.x86_64pigsty107.7 KiBpostgresql-19-oai-fdw_1.16.0-1PGSTY~bookworm_amd64.deb
postgresql-19-oai-fdw1.16.0d12.aarch64pigsty105.1 KiBpostgresql-19-oai-fdw_1.16.0-1PGSTY~bookworm_arm64.deb
postgresql-19-oai-fdw1.16.0d13.x86_64pigsty107.6 KiBpostgresql-19-oai-fdw_1.16.0-1PGSTY~trixie_amd64.deb
postgresql-19-oai-fdw1.16.0d13.aarch64pigsty104.7 KiBpostgresql-19-oai-fdw_1.16.0-1PGSTY~trixie_arm64.deb
postgresql-19-oai-fdw1.16.0u22.x86_64pigsty116.2 KiBpostgresql-19-oai-fdw_1.16.0-1PGSTY~jammy_amd64.deb
postgresql-19-oai-fdw1.16.0u22.aarch64pigsty114.6 KiBpostgresql-19-oai-fdw_1.16.0-1PGSTY~jammy_arm64.deb
postgresql-19-oai-fdw1.16.0u24.x86_64pigsty111.1 KiBpostgresql-19-oai-fdw_1.16.0-1PGSTY~noble_amd64.deb
postgresql-19-oai-fdw1.16.0u24.aarch64pigsty109.5 KiBpostgresql-19-oai-fdw_1.16.0-1PGSTY~noble_arm64.deb
postgresql-19-oai-fdw1.16.0u26.x86_64pigsty109.1 KiBpostgresql-19-oai-fdw_1.16.0-1PGSTY~resolute_amd64.deb
postgresql-19-oai-fdw1.16.0u26.aarch64pigsty108.1 KiBpostgresql-19-oai-fdw_1.16.0-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
oai_fdw_181.16.0el8.x86_64pigsty115.9 KiBoai_fdw_18-1.16.0-1PGSTY.el8.x86_64.rpm
oai_fdw_181.16.0el8.aarch64pigsty113.6 KiBoai_fdw_18-1.16.0-1PGSTY.el8.aarch64.rpm
oai_fdw_181.16.0el9.x86_64pigsty117.6 KiBoai_fdw_18-1.16.0-1PGSTY.el9.x86_64.rpm
oai_fdw_181.16.0el9.aarch64pigsty115.9 KiBoai_fdw_18-1.16.0-1PGSTY.el9.aarch64.rpm
oai_fdw_181.16.0el10.x86_64pigsty117.9 KiBoai_fdw_18-1.16.0-1PGSTY.el10.x86_64.rpm
oai_fdw_181.16.0el10.aarch64pigsty116.1 KiBoai_fdw_18-1.16.0-1PGSTY.el10.aarch64.rpm
postgresql-18-oai-fdw1.16.0d12.x86_64pigsty107.6 KiBpostgresql-18-oai-fdw_1.16.0-1PGSTY~bookworm_amd64.deb
postgresql-18-oai-fdw1.16.0d12.aarch64pigsty105.0 KiBpostgresql-18-oai-fdw_1.16.0-1PGSTY~bookworm_arm64.deb
postgresql-18-oai-fdw1.16.0d13.x86_64pigsty107.6 KiBpostgresql-18-oai-fdw_1.16.0-1PGSTY~trixie_amd64.deb
postgresql-18-oai-fdw1.16.0d13.aarch64pigsty104.8 KiBpostgresql-18-oai-fdw_1.16.0-1PGSTY~trixie_arm64.deb
postgresql-18-oai-fdw1.16.0u22.x86_64pigsty116.1 KiBpostgresql-18-oai-fdw_1.16.0-1PGSTY~jammy_amd64.deb
postgresql-18-oai-fdw1.16.0u22.aarch64pigsty114.4 KiBpostgresql-18-oai-fdw_1.16.0-1PGSTY~jammy_arm64.deb
postgresql-18-oai-fdw1.16.0u24.x86_64pigsty111.0 KiBpostgresql-18-oai-fdw_1.16.0-1PGSTY~noble_amd64.deb
postgresql-18-oai-fdw1.16.0u24.aarch64pigsty109.4 KiBpostgresql-18-oai-fdw_1.16.0-1PGSTY~noble_arm64.deb
postgresql-18-oai-fdw1.16.0u26.x86_64pigsty109.1 KiBpostgresql-18-oai-fdw_1.16.0-1PGSTY~resolute_amd64.deb
postgresql-18-oai-fdw1.16.0u26.aarch64pigsty108.0 KiBpostgresql-18-oai-fdw_1.16.0-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
oai_fdw_171.16.0el8.x86_64pigsty115.8 KiBoai_fdw_17-1.16.0-1PGSTY.el8.x86_64.rpm
oai_fdw_171.16.0el8.aarch64pigsty113.4 KiBoai_fdw_17-1.16.0-1PGSTY.el8.aarch64.rpm
oai_fdw_171.16.0el9.x86_64pigsty117.5 KiBoai_fdw_17-1.16.0-1PGSTY.el9.x86_64.rpm
oai_fdw_171.16.0el9.aarch64pigsty115.8 KiBoai_fdw_17-1.16.0-1PGSTY.el9.aarch64.rpm
oai_fdw_171.16.0el10.x86_64pigsty117.9 KiBoai_fdw_17-1.16.0-1PGSTY.el10.x86_64.rpm
oai_fdw_171.16.0el10.aarch64pigsty116.1 KiBoai_fdw_17-1.16.0-1PGSTY.el10.aarch64.rpm
postgresql-17-oai-fdw1.16.0d12.x86_64pigsty107.4 KiBpostgresql-17-oai-fdw_1.16.0-1PGSTY~bookworm_amd64.deb
postgresql-17-oai-fdw1.16.0d12.aarch64pigsty104.9 KiBpostgresql-17-oai-fdw_1.16.0-1PGSTY~bookworm_arm64.deb
postgresql-17-oai-fdw1.16.0d13.x86_64pigsty107.5 KiBpostgresql-17-oai-fdw_1.16.0-1PGSTY~trixie_amd64.deb
postgresql-17-oai-fdw1.16.0d13.aarch64pigsty104.6 KiBpostgresql-17-oai-fdw_1.16.0-1PGSTY~trixie_arm64.deb
postgresql-17-oai-fdw1.16.0u22.x86_64pigsty125.6 KiBpostgresql-17-oai-fdw_1.16.0-1PGSTY~jammy_amd64.deb
postgresql-17-oai-fdw1.16.0u22.aarch64pigsty123.8 KiBpostgresql-17-oai-fdw_1.16.0-1PGSTY~jammy_arm64.deb
postgresql-17-oai-fdw1.16.0u24.x86_64pigsty111.0 KiBpostgresql-17-oai-fdw_1.16.0-1PGSTY~noble_amd64.deb
postgresql-17-oai-fdw1.16.0u24.aarch64pigsty109.4 KiBpostgresql-17-oai-fdw_1.16.0-1PGSTY~noble_arm64.deb
postgresql-17-oai-fdw1.16.0u26.x86_64pigsty109.1 KiBpostgresql-17-oai-fdw_1.16.0-1PGSTY~resolute_amd64.deb
postgresql-17-oai-fdw1.16.0u26.aarch64pigsty108.0 KiBpostgresql-17-oai-fdw_1.16.0-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
oai_fdw_161.16.0el8.x86_64pigsty115.7 KiBoai_fdw_16-1.16.0-1PGSTY.el8.x86_64.rpm
oai_fdw_161.16.0el8.aarch64pigsty113.5 KiBoai_fdw_16-1.16.0-1PGSTY.el8.aarch64.rpm
oai_fdw_161.16.0el9.x86_64pigsty117.5 KiBoai_fdw_16-1.16.0-1PGSTY.el9.x86_64.rpm
oai_fdw_161.16.0el9.aarch64pigsty115.9 KiBoai_fdw_16-1.16.0-1PGSTY.el9.aarch64.rpm
oai_fdw_161.16.0el10.x86_64pigsty117.9 KiBoai_fdw_16-1.16.0-1PGSTY.el10.x86_64.rpm
oai_fdw_161.16.0el10.aarch64pigsty116.0 KiBoai_fdw_16-1.16.0-1PGSTY.el10.aarch64.rpm
postgresql-16-oai-fdw1.16.0d12.x86_64pigsty107.4 KiBpostgresql-16-oai-fdw_1.16.0-1PGSTY~bookworm_amd64.deb
postgresql-16-oai-fdw1.16.0d12.aarch64pigsty105.1 KiBpostgresql-16-oai-fdw_1.16.0-1PGSTY~bookworm_arm64.deb
postgresql-16-oai-fdw1.16.0d13.x86_64pigsty107.7 KiBpostgresql-16-oai-fdw_1.16.0-1PGSTY~trixie_amd64.deb
postgresql-16-oai-fdw1.16.0d13.aarch64pigsty104.8 KiBpostgresql-16-oai-fdw_1.16.0-1PGSTY~trixie_arm64.deb
postgresql-16-oai-fdw1.16.0u22.x86_64pigsty125.4 KiBpostgresql-16-oai-fdw_1.16.0-1PGSTY~jammy_amd64.deb
postgresql-16-oai-fdw1.16.0u22.aarch64pigsty123.5 KiBpostgresql-16-oai-fdw_1.16.0-1PGSTY~jammy_arm64.deb
postgresql-16-oai-fdw1.16.0u24.x86_64pigsty111.1 KiBpostgresql-16-oai-fdw_1.16.0-1PGSTY~noble_amd64.deb
postgresql-16-oai-fdw1.16.0u24.aarch64pigsty109.3 KiBpostgresql-16-oai-fdw_1.16.0-1PGSTY~noble_arm64.deb
postgresql-16-oai-fdw1.16.0u26.x86_64pigsty109.1 KiBpostgresql-16-oai-fdw_1.16.0-1PGSTY~resolute_amd64.deb
postgresql-16-oai-fdw1.16.0u26.aarch64pigsty108.0 KiBpostgresql-16-oai-fdw_1.16.0-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
oai_fdw_151.16.0el8.x86_64pigsty115.7 KiBoai_fdw_15-1.16.0-1PGSTY.el8.x86_64.rpm
oai_fdw_151.16.0el8.aarch64pigsty113.4 KiBoai_fdw_15-1.16.0-1PGSTY.el8.aarch64.rpm
oai_fdw_151.16.0el9.x86_64pigsty117.5 KiBoai_fdw_15-1.16.0-1PGSTY.el9.x86_64.rpm
oai_fdw_151.16.0el9.aarch64pigsty115.9 KiBoai_fdw_15-1.16.0-1PGSTY.el9.aarch64.rpm
oai_fdw_151.16.0el10.x86_64pigsty117.8 KiBoai_fdw_15-1.16.0-1PGSTY.el10.x86_64.rpm
oai_fdw_151.16.0el10.aarch64pigsty116.2 KiBoai_fdw_15-1.16.0-1PGSTY.el10.aarch64.rpm
postgresql-15-oai-fdw1.16.0d12.x86_64pigsty107.5 KiBpostgresql-15-oai-fdw_1.16.0-1PGSTY~bookworm_amd64.deb
postgresql-15-oai-fdw1.16.0d12.aarch64pigsty105.1 KiBpostgresql-15-oai-fdw_1.16.0-1PGSTY~bookworm_arm64.deb
postgresql-15-oai-fdw1.16.0d13.x86_64pigsty107.9 KiBpostgresql-15-oai-fdw_1.16.0-1PGSTY~trixie_amd64.deb
postgresql-15-oai-fdw1.16.0d13.aarch64pigsty104.8 KiBpostgresql-15-oai-fdw_1.16.0-1PGSTY~trixie_arm64.deb
postgresql-15-oai-fdw1.16.0u22.x86_64pigsty125.3 KiBpostgresql-15-oai-fdw_1.16.0-1PGSTY~jammy_amd64.deb
postgresql-15-oai-fdw1.16.0u22.aarch64pigsty123.6 KiBpostgresql-15-oai-fdw_1.16.0-1PGSTY~jammy_arm64.deb
postgresql-15-oai-fdw1.16.0u24.x86_64pigsty111.1 KiBpostgresql-15-oai-fdw_1.16.0-1PGSTY~noble_amd64.deb
postgresql-15-oai-fdw1.16.0u24.aarch64pigsty109.4 KiBpostgresql-15-oai-fdw_1.16.0-1PGSTY~noble_arm64.deb
postgresql-15-oai-fdw1.16.0u26.x86_64pigsty109.0 KiBpostgresql-15-oai-fdw_1.16.0-1PGSTY~resolute_amd64.deb
postgresql-15-oai-fdw1.16.0u26.aarch64pigsty108.0 KiBpostgresql-15-oai-fdw_1.16.0-1PGSTY~resolute_arm64.deb

源码

pig build pkg oai_fdw;		# build rpm/deb

安装

启用 PGDG 和 PIGSTY 仓库并更新缓存。

pig repo add pgsql -u   # add both repo and update cache

使用 pig 安装扩展。

pig install oai_fdw;		# install by package name

pig install oai_fdw -v 19;   # install for PG 19
pig install oai_fdw -v 18;   # install for PG 18
pig install oai_fdw -v 17;   # install for PG 17
pig install oai_fdw -v 16;   # install for PG 16
pig install oai_fdw -v 15;   # install for PG 15

在数据库中创建扩展。

CREATE EXTENSION oai_fdw;

用法

来源:

oai_fdw 1.16 是一个通过 HTTP 或 HTTPS 从 OAI-PMH 2.0 仓库采集元数据的外部数据包装器。它把 OAI 记录头和 XML 内容映射到外部表列,支持按仓库或 set 自动生成表,也可以把采集记录复制到本地表。

核心流程

先为仓库创建 server,再显式定义外部表或使用 IMPORT FOREIGN SCHEMA。每张表都需要 oai_dc 等元数据格式。

CREATE EXTENSION oai_fdw;
CREATE SCHEMA oai_data;

CREATE SERVER museum_oai
FOREIGN DATA WRAPPER oai_fdw
OPTIONS (url 'https://example.org/oai');

CREATE FOREIGN TABLE oai_data.records (
    id text OPTIONS (oai_node 'identifier'),
    content xml OPTIONS (oai_node 'content'),
    sets text[] OPTIONS (oai_node 'setspec'),
    datestamp timestamp OPTIONS (oai_node 'datestamp'),
    format text OPTIONS (oai_node 'metadataprefix'),
    status boolean OPTIONS (oai_node 'status')
)
SERVER museum_oai
OPTIONS (metadataprefix 'oai_dc');

SELECT id, datestamp
FROM oai_data.records
LIMIT 100;

如果没有 setspec,一次扫描可能采集仓库暴露的全部 set。可视情况使用 from、until 或 setspec 表选项和外层 LIMIT,但必须用远程服务验证实际请求行为。

导入与支持接口

  • IMPORT FOREIGN SCHEMA oai_repository 创建一张覆盖整个仓库的表;oai_sets 为每个 OAI set 创建一张表。两者都要求 metadataprefix 导入选项,并支持 LIMIT TO 或 EXCEPT。
  • 列选项 oai_node 把 identifier、setspec、datestamp、content、metadataprefix 或 status 映射到兼容的 PostgreSQL 类型。
  • Server 选项包括 url、http_proxy、connect_timeout、connect_retry、request_redirect 和 request_max_redirect。
  • OAI_HarvestTable 把外部表采集结果复制到本地表;OAI 支持函数暴露 set、格式等仓库元数据。

1.13 版把 proxy_user 和 proxy_password 移到了 user mapping。仓库 user 与 password 也应放在那里,并使用 HTTP Basic Authentication。

网络、凭据与一致性

查询会同步发出远程请求并解析不可信 XML。延迟、分页、服务限流、重定向、畸形响应及仓库变化都会影响结果。应把凭据放在最小权限 user mapping 中,限制创建或修改 server 的权限,并把可配置 URL/代理视为具有 SSRF 影响的出站网络访问。

OAI-PMH 是采集协议,不是事务数据库 API。重复扫描可能看到变化中的页面和删除记录;本地副本也会过期。应记录采集窗口与标识符,使刷新可重启,并显式协调删除/状态记录。1.13 版需要匹配的 libcurl/libxml2 构建依赖,还应针对每个目标仓库的元数据格式进行测试。

1.15 版本变化

HTTP 429 与 503 重试遵循退避及 Retry-After,from/until 校验和时间戳粒度检查更加严格。会检查服务器 USAGE 权限及视图所有者的用户映射,并修复采集时间窗口和取消处理。持续低速传输达到文档中的五分钟阈值后会中止。安装匹配文件后执行 ALTER EXTENSION oai_fdw UPDATE。PGXN 分发版本为 1.15.0,SQL/控制版本则为 1.15。

1.16 响应限制

可用 server 选项 max_response_size 限制响应字节数;即使未配置更小的上限,也有 1 GB 的硬限制。超过上限会中止请求。该 FDW 只读,INSERT、UPDATE 和 DELETE 现在立即报错。GetRecord 估计行数上限为 1,EXPLAIN 显示 server 标识。发行版 1.16.0 使用 SQL 版本 1.16;安装匹配文件后执行 ALTER EXTENSION oai_fdw UPDATE TO '1.16'。

表格阅读器