This FDW is similar to the provided file_fdw, except that insteadof the foreign table having named fields to match the fields in thedata file, it should have a single field of type text[]. The parsedfields will be stashed in the array. This is useful if you don'tknow how many fields are in the file, or if the number can varyfrom line to line. Unlike standard COPY files and the file_fdwmodule, this module doesn't care how many fields there are - howevermany it finds on each line will be put into the array.
-- only needs to be done onceCREATE EXTENSION file_textarray_fdw;-- usually only needs to be done onceCREATE SERVER file_server FOREIGN DATA WRAPPER file_textarray_fdw;CREATE FOREIGN TABLE agg_csv_array ( ttext[]) SERVER file_server OPTIONS (format'csv', filename'/path/to/agg.csv', header'true', delimiter';', quote'@', escape'"',null'');SELECT t[1]::int2AS a, t[2]::float4AS bFROM agg_csv_array;