oai_fdw
oai_fdw : Read-only OAI-PMH foreign data wrapper for metadata harvesting over HTTP/HTTPS.
Overview
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | rdf_fdw http postgres_fdw |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.16 |
18 17 16 15 14 | oai_fdw |
- |
| RPM | PIGSTY | 1.16.0 |
18 17 16 15 14 | oai_fdw_$v |
- |
| DEB | PIGSTY | 1.16.0 |
18 17 16 15 14 | postgresql-$v-oai-fdw |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| el8.aarch64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| el9.x86_64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| el9.aarch64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| el10.x86_64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| el10.aarch64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| d12.x86_64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| d12.aarch64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| d13.x86_64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| d13.aarch64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| u22.x86_64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| u22.aarch64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| u24.x86_64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| u24.aarch64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| u26.x86_64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
| u26.aarch64 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 | PIGSTY 1.16.0 |
Source
github.com/jimjonesbr/oai_fdw
oai_fdw-1.16.0.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
Sources:
- CHANGELOG.md
- Official v1.16 README
- Official v1.16 control file
- Official v1.16 changelog
- Official OAI-PMH specification
oai_fdw 1.16 is a foreign data wrapper for harvesting metadata from OAI-PMH 2.0 repositories over HTTP or HTTPS. It maps OAI record headers and XML content to foreign-table columns, supports automatic table generation for repositories or sets, and can copy harvested records into local tables.
Core Workflow
Create a server for the repository, then either define a foreign table explicitly or use IMPORT FOREIGN SCHEMA. Every table needs a metadata format such as oai_dc.
Without setspec, a scan can harvest every set exposed by the repository. Use from, until, or setspec table options and an outer LIMIT where appropriate, but verify request behavior with the remote service.
Import and Support Interfaces
IMPORT FOREIGN SCHEMA oai_repositorycreates one table spanning the repository;oai_setscreates a table per OAI set. Both require themetadataprefiximport option and supportLIMIT TOorEXCEPT.- Column option
oai_nodemapsidentifier,setspec,datestamp,content,metadataprefix, orstatusto compatible PostgreSQL types. - Server options include
url,http_proxy,connect_timeout,connect_retry,request_redirect, andrequest_max_redirect. OAI_HarvestTablecopies a foreign-table harvest into a local table; OAI support functions expose repository metadata such as sets and formats.
Version 1.13 moves proxy_user and proxy_password to the user mapping. Repository user and password also belong there and use HTTP Basic Authentication.
Network, Credentials, and Consistency
Queries perform synchronous remote requests and parse untrusted XML. Latency, pagination, server throttling, redirects, malformed responses, and repository changes affect results. Store credentials in narrowly scoped user mappings, restrict who may create or alter servers, and treat configurable URLs/proxies as outbound-network access with SSRF implications.
OAI-PMH is a harvesting protocol, not a transactional database API. Repeated scans can observe changing pages and deletions; local copies become stale. Record harvest windows and identifiers, make refreshes restartable, and reconcile deleted/status records explicitly. Version 1.13 requires matching libcurl/libxml2 build dependencies and should be tested against each target repository’s metadata format.
Version 1.15
HTTP 429 and 503 retries respect backoff/Retry-After; from/until validation and timestamp granularity are stricter. Server USAGE and view-owner user mappings are checked. Harvest windows and cancellation handling are corrected, and stalled transfers abort after the documented five-minute low-speed threshold. Install matching files and apply ALTER EXTENSION oai_fdw UPDATE. PGXN calls this distribution 1.15.0, while the SQL/control version is 1.15.
1.16 Response Limits
Use the server option max_response_size to bound response bytes; a hard 1 GB ceiling applies even without a smaller configured limit. Exceeding the cap aborts the request. The FDW is read-only: INSERT, UPDATE and DELETE now fail immediately. GetRecord row estimates are capped at one, and EXPLAIN includes the server identity. Distribution 1.16.0 uses SQL version 1.16; install matching files and run ALTER EXTENSION oai_fdw UPDATE TO '1.16'.