oss_fdw
oss_fdw · Alibaba Cloud OSS foreign data wrapper for reading and writing OSS objects from PostgreSQL-compatible managed services.
Overview
PostgreSQL · 11, 14, 16
Usage
Sources:
oss_fdw is an Alibaba Cloud PolarDB provider extension that maps Object Storage Service directories or file prefixes to PostgreSQL foreign tables. It is designed for append-only archives and cold data on supported PolarDB for PostgreSQL-compatible service revisions, not as a portable community FDW for self-managed PostgreSQL.
Core Workflow
Enable the provider extension, define an OSS server, and map a directory to a foreign table:
Use exactly one of dir or prefix for the object mapping. format defaults to CSV. compressiontype can select gzip or, on supported PostgreSQL 14 service revisions, Zstandard; compressionlevel controls the provider-supported range.
Write and Removal Semantics
SELECT, INSERT, and TRUNCATE are supported; UPDATE and DELETE are not. Each INSERT execution creates a new OSS file instead of modifying an existing one. TRUNCATE public.events_archive removes all OSS files mapped to that foreign table, so treat it as destructive object-store deletion rather than ordinary local-table cleanup.
Dropping a foreign table or the extension is distinct from truncating mapped data. Confirm the provider’s behavior and preserve independent OSS retention or backups before removing definitions.
Provider and Security Boundaries
The server options contain OSS access credentials. Use a dedicated RAM identity with the minimum bucket permissions, restrict USAGE on the foreign server, and avoid exposing catalog metadata or DDL to untrusted roles. Prefer an internal endpoint in the same region as the PolarDB cluster when supported; network placement affects both reachability and performance.
Availability, exact version, supported PostgreSQL revisions, regions, compression algorithms, and privileges are controlled by Alibaba Cloud. Check the extension list and service documentation for the target cluster before running the example. Access to OSS has substantially different latency and transaction behavior from local PostgreSQL storage; test retries, partial failures, file accumulation, and downstream readers before using it for archival workflows.