file_fixed_length_fdw
file_fixed_length_fdw · Foreign data wrapper for files with fixed-length fields.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100086 | file_fixed_length_fdw | file_fixed_length_fdw | 1.0 | FDW | Unknown | C |
Usage
Sources:
file_fixed_length_fdw exposes delimiter-free, fixed-width records as a read-only foreign table. Use it when every record has the same byte layout and returning one text[] value per record is acceptable.
Core Workflow
Create the wrapper, a server, and a foreign table with exactly one text[] column. The lengths list determines both the number of array elements and the number of bytes consumed by each element.
Options and Objects
filenameis required and is read by the PostgreSQL server process.field_lengthsis a comma-separated list of byte lengths; the foreign table must still have only one column.trimremoves leading and trailing ASCII spaces from every extracted field.record_separatoracceptsnone,lf,cr, orcrlfand contributes zero, one, or two bytes to each physical record.encodingvalidates and converts field bytes to the server encoding; without it, the client encoding is used.
The extension installs the file_fixed_length_fdw foreign-data wrapper, its handler, and its validator. It implements scanning and rescanning only; there is no write path.
Operational Notes
Only a superuser can set or change the foreign-table options because filename grants server-side file access. The implementation requires every read to return one complete fixed-size record; a short trailing record is an error. Lengths describe bytes rather than characters, so test multibyte encodings carefully. The upstream control-file comment mentions SNMP, but the implementation and repository identify this as a fixed-length file wrapper.