PostgreSQL 9.1.24 Documentation | ||||
---|---|---|---|---|
Prev | Up | Appendix F. Additional Supplied Modules | Next |
The file_fdw module provides the
foreign-data wrapper file_fdw
,
which can be used to access data files in the server's file
system. Data files must be in a format that can be read by
COPY FROM; see COPY for details.
A foreign table created using this wrapper can have the following options:
Specifies the file to be read. Required. Must be an absolute path name.
Specifies the file's format, the same as COPY's FORMAT option.
Specifies whether the file has a header line, the same as COPY's HEADER option.
Specifies the file's delimiter character, the same as COPY's DELIMITER option.
Specifies the file's quote character, the same as COPY's QUOTE option.
Specifies the file's escape character, the same as COPY's ESCAPE option.
Specifies the file's null string, the same as COPY's NULL option.
Specifies the file's encoding. the same as COPY's ENCODING option.
COPY's OIDS, FORCE_QUOTE, and FORCE_NOT_NULL options are currently not supported by file_fdw.
These options can only be specified for a foreign table, not in the options of the file_fdw foreign-data wrapper, nor in the options of a server or user mapping using the wrapper.
Changing table-level options requires superuser privileges, for security reasons: only a superuser should be able to determine which file is read. In principle non-superusers could be allowed to change the other options, but that's not supported at present.
For a foreign table using file_fdw, EXPLAIN shows the name of the file to be read. Unless COSTS OFF is specified, the file size (in bytes) is shown as well.