file_textarray_fdw

This Release
file_textarray_fdw 1.0.1
Date
Status
Stable
Other Releases
Abstract
Access to text files where each row is returned as an array of text
Description
Similar to the file Foreign data wrapper, but useful for handling cases where the number of fields per line is unknown or varies.
Released By
andrew
License
PostgreSQL
Resources
Special Files
Tags

Extensions

file_textarray_fdw 1.0.1
Access to text files where each row is returned as an array of text

README

File Text Array Foreign Data Wrapper for PostgreSQL

This FDW is similar to the provided file_fdw, except that instead of the foreign table having named fields to match the fields in the data file, it should have a single field of type text[]. The parsed fields will be stashed in the array. This is useful if you don't know how many fields are in the file, or if the number can vary from line to line. Unlike standard COPY files and the file_fdw module, this module doesn't care how many fields there are - however many it finds on each line will be put into the array.

Example of use:

```sql -- only needs to be done once CREATE EXTENSION file_textarray_fdw;

-- usually only needs to be done once CREATE SERVER file_server FOREIGN DATA WRAPPER file_textarray_fdw;

CREATE FOREIGN TABLE agg_csv_array ( t text[] ) SERVER file_server OPTIONS (format 'csv', filename '/path/to/agg.csv', header 'true', delimiter ';', quote '@', escape '"', null '');

SELECT t[1]::int2 AS a, t[2]::float4 AS b FROM agg_csv_array; ```