{"Entry":{"collection":"fdw","key":"file_fdw","name":"file_fdw","aliases":[],"metadata":{"aliases":[],"category":"Server files","content_hash":"c584bcf961f646facb34f819b6db7b99a0e4024434cff56684c2c803ac8bb38f","derived_content_hash":"88885d2b4b68bc7bd3a13ee8f865ce673626dd1c1813261eb0c8d23be8763ff7","imported_at":"2026-09-30T00:40:37.170312+08:00","name":"file_fdw","name_zh":"Server files","slug":"file_fdw","summary":"Reads server-side files or program output through the foreign-data wrapper interface."}},"Definition":{"Collection":"fdw","Key":"file_fdw","SourceDatabase":"center","Version":"18","SourceTable":"foreign_data_wrapper","SourceKey":"file_fdw","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","Facts":{"callbacks":{"AnalyzeForeignTable":"fileAnalyzeForeignTable","BeginForeignScan":"fileBeginForeignScan","EndForeignScan":"fileEndForeignScan","ExplainForeignScan":"fileExplainForeignScan","GetForeignPaths":"fileGetForeignPaths","GetForeignPlan":"fileGetForeignPlan","GetForeignRelSize":"fileGetForeignRelSize","IsForeignScanParallelSafe":"fileIsForeignScanParallelSafe","IterateForeignScan":"fileIterateForeignScan","ReScanForeignScan":"fileReScanForeignScan"},"comparison_data":{"callbacks":{"AnalyzeForeignTable":"fileAnalyzeForeignTable","BeginForeignScan":"fileBeginForeignScan","EndForeignScan":"fileEndForeignScan","ExplainForeignScan":"fileExplainForeignScan","GetForeignPaths":"fileGetForeignPaths","GetForeignPlan":"fileGetForeignPlan","GetForeignRelSize":"fileGetForeignRelSize","IsForeignScanParallelSafe":"fileIsForeignScanParallelSafe","IterateForeignScan":"fileIterateForeignScan","ReScanForeignScan":"fileReScanForeignScan"},"options":[{"definition":"Specifies the file to be read. Relative paths are relative to the data directory. Either filename or program must be specified, but not both.","name":"filename"},{"definition":"Specifies the command to be executed. The standard output of this command will be read as though COPY FROM PROGRAM were used. Either program or filename must be specified, but not both.","name":"program"},{"definition":"Specifies the data format, the same as COPY 's FORMAT option.","name":"format"},{"definition":"Specifies whether the data has a header line, the same as COPY 's HEADER option.","name":"header"},{"definition":"Specifies the data delimiter character, the same as COPY 's DELIMITER option.","name":"delimiter"},{"definition":"Specifies the data quote character, the same as COPY 's QUOTE option.","name":"quote"},{"definition":"Specifies the data escape character, the same as COPY 's ESCAPE option.","name":"escape"},{"definition":"Specifies the data null string, the same as COPY 's NULL option.","name":"null"},{"definition":"Specifies the string that represents a default value, the same as COPY 's DEFAULT option.","name":"default"},{"definition":"Specifies the data encoding, the same as COPY 's ENCODING option.","name":"encoding"},{"definition":"Specifies how to behave when encountering an error converting a column's input value into its data type, the same as COPY 's ON_ERROR option.","name":"on_error"},{"definition":"Specifies the maximum number of errors tolerated while converting a column's input value to its data type, the same as COPY 's REJECT_LIMIT option.","name":"reject_limit"},{"definition":"Specifies the amount of messages emitted by file_fdw , the same as COPY 's LOG_VERBOSITY option.","name":"log_verbosity"},{"definition":"This is a Boolean option. If true, it specifies that values of the column should not be matched against the null string (that is, the table-level null option). This has the same effect as listing the column in COPY 's FORCE_NOT_NULL option.","name":"force_not_null"},{"definition":"This is a Boolean option. If true, it specifies that values of the column which match the null string are returned as NULL even if the value is quoted. Without this option, only unquoted values matching the null string are returned as NULL . This has the same effect as listing the column in COPY 's FORCE_NULL option.","name":"force_null"}],"protocol_versions":{},"source_options":[]},"comparison_hash":"3a50d8e658a12e9ec3405a8fd6dae6ec70a2fe3837297394492fb97a95b01306","description":["Reads server-side files or program output through the foreign-data wrapper interface."],"description_zh":"file_fdw 模块提供了外部数据包装器 file_fdw ，可用于访问服务器文件系统中的数据文件，或者在服务器上执行程序并读取其输出。数据文件或程序输出必须采用 COPY FROM 可读取的格式；详见 COPY 。当前对数据文件的访问为只读。 使用此包装器创建的外部表可以具有下列选项： 请注意，虽然 COPY 允许诸如 HEADER 这样的选项在没有对应值的情况下指定，但外部表选项语法要求在所有情况下都必须提供一个值。要启用通常写成不带值的 COPY 选项，可以传入值 TRUE ，因为所有这类选项都是布尔值。 使用此包装器创建的外部表的列可以具有下列选项：","description_zh_html":"\u003cp\u003e外部数据包装器 file_fdw。\u003c/p\u003e\u003ch3\u003e同版本中文手册节选\u003c/h3\u003e\u003cp\u003e\n\u003ccode class=\"filename\"\u003efile_fdw\u003c/code\u003e 模块提供了外部数据包装器\n  \u003ccode class=\"function\"\u003efile_fdw\u003c/code\u003e，可用于访问服务器文件系统中的数据文件，或者在服务器上执行程序并读取其输出。数据文件或程序输出必须采用\n  \u003ccode class=\"command\"\u003eCOPY FROM\u003c/code\u003e 可读取的格式；详见 \u003ca class=\"xref\" href=\"/zh/docs/18/sql-copy.html\"\u003e\u003cspan class=\"refentrytitle\"\u003eCOPY\u003c/span\u003e\u003c/a\u003e。当前对数据文件的访问为只读。\n \u003c/p\u003e\u003cp\u003e\n  使用此包装器创建的外部表可以具有下列选项：\n \u003c/p\u003e\u003cp\u003e\n  请注意，虽然 \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e 允许诸如 \u003ccode class=\"literal\"\u003eHEADER\u003c/code\u003e 这样的选项在没有对应值的情况下指定，但外部表选项语法要求在所有情况下都必须提供一个值。要启用通常写成不带值的\n  \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e 选项，可以传入值 \u003ccode class=\"literal\"\u003eTRUE\u003c/code\u003e，因为所有这类选项都是布尔值。\n \u003c/p\u003e\u003cp\u003e\n  使用此包装器创建的外部表的列可以具有下列选项：\n \u003c/p\u003e\u003cp\u003e\u003ca href=\"/zh/docs/18/file-fdw.html\"\u003e查看完整中文手册与上下文\u003c/a\u003e。\u003c/p\u003e","evidence_kind":"source and documentation","facts":[{"label":"Interface family","value":"Foreign-data wrapper"},{"label":"Handler or routine","value":"file_fdw_handler"},{"label":"Recorded callbacks","value":"10"}],"facts_zh":[{"label":"接口类别","value":"外部数据包装器"},{"label":"处理函数或例程","value":"file_fdw_handler"},{"label":"记录的回调","value":"10"}],"manual_html":"\u003cdiv class=\"sect1\" id=\"FILE-FDW\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch2 class=\"title\"\u003eF.15. file_fdw — access data files in the server's file system \u003c/h2\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eThe \u003ccode class=\"filename\"\u003efile_fdw\u003c/code\u003e module provides the foreign-data wrapper \u003ccode class=\"function\"\u003efile_fdw\u003c/code\u003e, which can be used to access data files in the server's file system, or to execute programs on the server and read their output. The data file or program output must be in a format that can be read by \u003ccode class=\"command\"\u003eCOPY FROM\u003c/code\u003e; see \u003ca class=\"xref\" href=\"/docs/18/sql-copy.html\" title=\"COPY\"\u003e\u003cspan class=\"refentrytitle\"\u003eCOPY\u003c/span\u003e\u003c/a\u003e for details. Access to data files is currently read-only.\u003c/p\u003e\n\u003cp\u003eA foreign table created using this wrapper can have the following options:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efilename\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the file to be read. Relative paths are relative to the data directory. Either \u003ccode class=\"literal\"\u003efilename\u003c/code\u003e or \u003ccode class=\"literal\"\u003eprogram\u003c/code\u003e must be specified, but not both.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eprogram\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the command to be executed. The standard output of this command will be read as though \u003ccode class=\"command\"\u003eCOPY FROM PROGRAM\u003c/code\u003e were used. Either \u003ccode class=\"literal\"\u003eprogram\u003c/code\u003e or \u003ccode class=\"literal\"\u003efilename\u003c/code\u003e must be specified, but not both.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eformat\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data format, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eFORMAT\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eheader\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether the data has a header line, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eHEADER\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003edelimiter\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data delimiter character, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eDELIMITER\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003equote\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data quote character, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eQUOTE\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eescape\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data escape character, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eESCAPE\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003enull\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data null string, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003edefault\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the string that represents a default value, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eDEFAULT\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eencoding\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data encoding, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eENCODING\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eon_error\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies how to behave when encountering an error converting a column's input value into its data type, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eON_ERROR\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ereject_limit\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the maximum number of errors tolerated while converting a column's input value to its data type, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eREJECT_LIMIT\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003elog_verbosity\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the amount of messages emitted by \u003ccode class=\"literal\"\u003efile_fdw\u003c/code\u003e, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eLOG_VERBOSITY\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eNote that while \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e allows options such as \u003ccode class=\"literal\"\u003eHEADER\u003c/code\u003e to be specified without a corresponding value, the foreign table option syntax requires a value to be present in all cases. To activate \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e options typically written without a value, you can pass the value TRUE, since all such options are Booleans.\u003c/p\u003e\n\u003cp\u003eA column of a foreign table created using this wrapper can have the following options:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eforce_not_null\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is a Boolean option. If true, it specifies that values of the column should not be matched against the null string (that is, the table-level \u003ccode class=\"literal\"\u003enull\u003c/code\u003e option). This has the same effect as listing the column in \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eFORCE_NOT_NULL\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eforce_null\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is a Boolean option. If true, it specifies that values of the column which match the null string are returned as \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e even if the value is quoted. Without this option, only unquoted values matching the null string are returned as \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e. This has the same effect as listing the column in \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eFORCE_NULL\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eFORCE_QUOTE\u003c/code\u003e option is currently not supported by \u003ccode class=\"literal\"\u003efile_fdw\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThese options can only be specified for a foreign table or its columns, not in the options of the \u003ccode class=\"literal\"\u003efile_fdw\u003c/code\u003e foreign-data wrapper, nor in the options of a server or user mapping using the wrapper.\u003c/p\u003e\n\u003cp\u003eChanging table-level options requires being a superuser or having the privileges of the role \u003ccode class=\"literal\"\u003epg_read_server_files\u003c/code\u003e (to use a filename) or the role \u003ccode class=\"literal\"\u003epg_execute_server_program\u003c/code\u003e (to use a program), for security reasons: only certain users should be able to control which file is read or which program is run. In principle regular users could be allowed to change the other options, but that's not supported at present.\u003c/p\u003e\n\u003cp\u003eWhen specifying the \u003ccode class=\"literal\"\u003eprogram\u003c/code\u003e option, keep in mind that the option string is executed by the shell. If you need to pass any arguments to the command that come from an untrusted source, you must be careful to strip or escape any characters that might have special meaning to the shell. For security reasons, it is best to use a fixed command string, or at least avoid passing any user input in it.\u003c/p\u003e\n\u003cp\u003eFor a foreign table using \u003ccode class=\"literal\"\u003efile_fdw\u003c/code\u003e, \u003ccode class=\"command\"\u003eEXPLAIN\u003c/code\u003e shows the name of the file to be read or program to be run. For a file, unless \u003ccode class=\"literal\"\u003eCOSTS OFF\u003c/code\u003e is specified, the file size (in bytes) is shown as well.\u003c/p\u003e\n\u003cdiv class=\"example\" id=\"id-1.11.7.25.14\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eExample F.1. Create a Foreign Table for PostgreSQL CSV Logs\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"example-contents\"\u003e\n\u003cp\u003eOne of the obvious uses for \u003ccode class=\"literal\"\u003efile_fdw\u003c/code\u003e is to make the PostgreSQL activity log available as a table for querying. To do this, first you must be \u003ca class=\"link\" href=\"/docs/18/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-CSVLOG\" title=\"19.8.4. Using CSV-Format Log Output\"\u003elogging to a CSV file,\u003c/a\u003e which here we will call \u003ccode class=\"literal\"\u003epglog.csv\u003c/code\u003e. First, install \u003ccode class=\"literal\"\u003efile_fdw\u003c/code\u003e as an extension:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eCREATE EXTENSION file_fdw;\n\u003c/pre\u003e\n\u003cp\u003eThen create a foreign server:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eCREATE SERVER pglog FOREIGN DATA WRAPPER file_fdw;\n\u003c/pre\u003e\n\u003cp\u003eNow you are ready to create the foreign data table. Using the \u003ccode class=\"command\"\u003eCREATE FOREIGN TABLE\u003c/code\u003e command, you will need to define the columns for the table, the CSV file name, and its format:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eCREATE FOREIGN TABLE pglog (\n  log_time timestamp(3) with time zone,\n  user_name text,\n  database_name text,\n  process_id integer,\n  connection_from text,\n  session_id text,\n  session_line_num bigint,\n  command_tag text,\n  session_start_time timestamp with time zone,\n  virtual_transaction_id text,\n  transaction_id bigint,\n  error_severity text,\n  sql_state_code text,\n  message text,\n  detail text,\n  hint text,\n  internal_query text,\n  internal_query_pos integer,\n  context text,\n  query text,\n  query_pos integer,\n  location text,\n  application_name text,\n  backend_type text,\n  leader_pid integer,\n  query_id bigint\n) SERVER pglog\nOPTIONS ( filename 'log/pglog.csv', format 'csv' );\n\u003c/pre\u003e\n\u003cp\u003eThat's it — now you can query your log directly. In production, of course, you would need to define some way to deal with log rotation.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"example-break\"\u003e\n\u003cdiv class=\"example\" id=\"id-1.11.7.25.15\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eExample F.2. Create a Foreign Table with an Option on a Column\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"example-contents\"\u003e\n\u003cp\u003eTo set the \u003ccode class=\"literal\"\u003eforce_null\u003c/code\u003e option for a column, use the \u003ccode class=\"literal\"\u003eOPTIONS\u003c/code\u003e keyword.\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eCREATE FOREIGN TABLE films (\n code char(5) NOT NULL,\n title text NOT NULL,\n rating text OPTIONS (force_null 'true')\n) SERVER film_server\nOPTIONS ( filename 'films/db.csv', format 'csv' );\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"example-break\"\u003e\n\u003c/div\u003e","manual_path":"/docs/18/file-fdw.html","related":[{"label":"Foreign-data wrapper catalog","url":"/wiki/catalog/pg_foreign_data_wrapper/?v=18"},{"label":"Existing extension catalogue identity","url":"/e/file_fdw/"},{"label":"Foreign Scan plan node","url":"/wiki/plan/foreign-scan/?v=18"}],"release":{"channel":"stable","label":"18.6","major":"18","ref":"PostgreSQL 18.6 source archive","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_snapshot_utc":"","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},"runtime_verified":false,"sections":[{"paragraphs":["The matrix records callbacks actually registered in this source build. Registration identifies an implemented interface hook; options, query shape, privileges and provider rules determine whether an operation is allowed.","The complete same-version manual below retains configuration, constraints and examples. No runtime capability test is claimed."],"title":"Interface and capability boundaries"},{"paragraphs":["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, or to execute programs on the server and read their output. The data file or program output must be in a format that can be read by COPY FROM ; see COPY for details. Access to data files is currently read-only."],"title":"File access boundary"},{"code":"{\n\tFdwRoutine *fdwroutine = makeNode(FdwRoutine);\n\n\tfdwroutine-\u003eGetForeignRelSize = fileGetForeignRelSize;\n\tfdwroutine-\u003eGetForeignPaths = fileGetForeignPaths;\n\tfdwroutine-\u003eGetForeignPlan = fileGetForeignPlan;\n\tfdwroutine-\u003eExplainForeignScan = fileExplainForeignScan;\n\tfdwroutine-\u003eBeginForeignScan = fileBeginForeignScan;\n\tfdwroutine-\u003eIterateForeignScan = fileIterateForeignScan;\n\tfdwroutine-\u003eReScanForeignScan = fileReScanForeignScan;\n\tfdwroutine-\u003eEndForeignScan = fileEndForeignScan;\n\tfdwroutine-\u003eAnalyzeForeignTable = fileAnalyzeForeignTable;\n\tfdwroutine-\u003eIsForeignScanParallelSafe = fileIsForeignScanParallelSafe;\n\n\tPG_RETURN_POINTER(fdwroutine);\n}","title":"Registered implementation in core source"}],"sections_zh":[{"paragraphs":["矩阵记录此源码构建实际注册的回调。注册表明实现了相应接口钩子；操作是否允许还取决于选项、查询形式、权限和提供方规则。","下方保留同版本完整手册，包括配置、约束和示例。不声称已进行运行时能力测试。"],"title":"接口与能力边界"},{"paragraphs":["file_fdw 模块提供了外部数据包装器 file_fdw ，可用于访问服务器文件系统中的数据文件，或者在服务器上执行程序并读取其输出。数据文件或程序输出必须采用 COPY FROM 可读取的格式；详见 COPY 。当前对数据文件的访问为只读。"],"title":"文件访问边界"},{"code":"{\n\tFdwRoutine *fdwroutine = makeNode(FdwRoutine);\n\n\tfdwroutine-\u003eGetForeignRelSize = fileGetForeignRelSize;\n\tfdwroutine-\u003eGetForeignPaths = fileGetForeignPaths;\n\tfdwroutine-\u003eGetForeignPlan = fileGetForeignPlan;\n\tfdwroutine-\u003eExplainForeignScan = fileExplainForeignScan;\n\tfdwroutine-\u003eBeginForeignScan = fileBeginForeignScan;\n\tfdwroutine-\u003eIterateForeignScan = fileIterateForeignScan;\n\tfdwroutine-\u003eReScanForeignScan = fileReScanForeignScan;\n\tfdwroutine-\u003eEndForeignScan = fileEndForeignScan;\n\tfdwroutine-\u003eAnalyzeForeignTable = fileAnalyzeForeignTable;\n\tfdwroutine-\u003eIsForeignScanParallelSafe = fileIsForeignScanParallelSafe;\n\n\tPG_RETURN_POINTER(fdwroutine);\n}","title":"核心源码中注册的实现"}],"sources":[{"label":"PostgreSQL 18 English manual","path":"file-fdw.html","sha256":"5da35cee02e73ec6656a2020d8351046cad9283a137b45064bee58f1ff7eb787","url":"/docs/18/file-fdw.html"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"contrib/file_fdw/file_fdw.c:183","line":183,"path":"contrib/file_fdw/file_fdw.c","sha256":"d79ec21c08be6a806b0710aab09698678ddb24103d3470702e66ee1523432125","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"}],"tables":[{"columns":[{"key":"feature","label":"Interface operation"},{"key":"state","label":"Source observation"},{"key":"callback","label":"Callback"},{"key":"implementation","label":"Implementation"}],"key":"callbacks","rows":[{"callback":"IterateForeignScan","feature":"Scan rows","implementation":"fileIterateForeignScan","state":"Handler registered; conditions apply"},{"callback":"ExecForeignInsert","feature":"INSERT","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"ExecForeignUpdate","feature":"UPDATE","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"ExecForeignDelete","feature":"DELETE","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"ExecForeignTruncate","feature":"TRUNCATE","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"GetForeignJoinPaths","feature":"Join path pushdown","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"GetForeignUpperPaths","feature":"Upper paths, including aggregation","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"ExecForeignBatchInsert","feature":"Batch insert","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"ForeignAsyncRequest","feature":"Asynchronous append execution","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"ImportForeignSchema","feature":"Import schema","implementation":"Not registered","state":"No handler registered in this build"}],"title":"Registered interface handlers"},{"columns":[{"key":"name","label":"Option"},{"key":"definition","label":"Same-version definition"}],"key":"options","rows":[{"definition":"Specifies the file to be read. Relative paths are relative to the data directory. Either filename or program must be specified, but not both.","name":"filename"},{"definition":"Specifies the command to be executed. The standard output of this command will be read as though COPY FROM PROGRAM were used. Either program or filename must be specified, but not both.","name":"program"},{"definition":"Specifies the data format, the same as COPY 's FORMAT option.","name":"format"},{"definition":"Specifies whether the data has a header line, the same as COPY 's HEADER option.","name":"header"},{"definition":"Specifies the data delimiter character, the same as COPY 's DELIMITER option.","name":"delimiter"},{"definition":"Specifies the data quote character, the same as COPY 's QUOTE option.","name":"quote"},{"definition":"Specifies the data escape character, the same as COPY 's ESCAPE option.","name":"escape"},{"definition":"Specifies the data null string, the same as COPY 's NULL option.","name":"null"},{"definition":"Specifies the string that represents a default value, the same as COPY 's DEFAULT option.","name":"default"},{"definition":"Specifies the data encoding, the same as COPY 's ENCODING option.","name":"encoding"},{"definition":"Specifies how to behave when encountering an error converting a column's input value into its data type, the same as COPY 's ON_ERROR option.","name":"on_error"},{"definition":"Specifies the maximum number of errors tolerated while converting a column's input value to its data type, the same as COPY 's REJECT_LIMIT option.","name":"reject_limit"},{"definition":"Specifies the amount of messages emitted by file_fdw , the same as COPY 's LOG_VERBOSITY option.","name":"log_verbosity"},{"definition":"This is a Boolean option. If true, it specifies that values of the column should not be matched against the null string (that is, the table-level null option). This has the same effect as listing the column in COPY 's FORCE_NOT_NULL option.","name":"force_not_null"},{"definition":"This is a Boolean option. If true, it specifies that values of the column which match the null string are returned as NULL even if the value is quoted. Without this option, only unquoted values matching the null string are returned as NULL . This has the same effect as listing the column in COPY 's FORCE_NULL option.","name":"force_null"}],"title":"Documented options"}],"tables_zh":[{"columns":[{"key":"feature","label":"接口操作"},{"key":"state","label":"源码观察"},{"key":"callback","label":"回调"},{"key":"implementation","label":"实现"}],"key":"callbacks","rows":[{"callback":"IterateForeignScan","feature":"扫描数据行","implementation":"fileIterateForeignScan","state":"已注册处理函数；适用条件限制"},{"callback":"ExecForeignInsert","feature":"INSERT","implementation":"未登记","state":"此构建未注册处理函数"},{"callback":"ExecForeignUpdate","feature":"UPDATE","implementation":"未登记","state":"此构建未注册处理函数"},{"callback":"ExecForeignDelete","feature":"DELETE","implementation":"未登记","state":"此构建未注册处理函数"},{"callback":"ExecForeignTruncate","feature":"TRUNCATE","implementation":"未登记","state":"此构建未注册处理函数"},{"callback":"GetForeignJoinPaths","feature":"连接路径下推","implementation":"未登记","state":"此构建未注册处理函数"},{"callback":"GetForeignUpperPaths","feature":"上层路径，包括聚合","implementation":"未登记","state":"此构建未注册处理函数"},{"callback":"ExecForeignBatchInsert","feature":"批量插入","implementation":"未登记","state":"此构建未注册处理函数"},{"callback":"ForeignAsyncRequest","feature":"异步追加执行","implementation":"未登记","state":"此构建未注册处理函数"},{"callback":"ImportForeignSchema","feature":"导入模式","implementation":"未登记","state":"此构建未注册处理函数"}],"title":"注册的接口处理函数"},{"columns":[{"key":"name","label":"选项"},{"key":"definition","label":"同版本定义"}],"key":"options","rows":[{"definition":"指定要读取的文件。相对路径以数据目录为基准。必须指定 filename 或 program 之一，但不能同时指定二者。","name":"filename"},{"definition":"指定要执行的命令。该命令的标准输出会按使用 COPY FROM PROGRAM 时的方式读取。必须指定 program 或 filename 之一，但不能同时指定二者。","name":"program"},{"definition":"指定数据格式，与 COPY 的 FORMAT 选项相同。","name":"format"},{"definition":"指定数据是否包含标题行，与 COPY 的 HEADER 选项相同。","name":"header"},{"definition":"指定数据的定界符字符，与 COPY 的 DELIMITER 选项相同。","name":"delimiter"},{"definition":"指定数据的引用字符，与 COPY 的 QUOTE 选项相同。","name":"quote"},{"definition":"指定数据的转义字符，与 COPY 的 ESCAPE 选项相同。","name":"escape"},{"definition":"指定数据的空值串，与 COPY 的 NULL 选项相同。","name":"null"},{"definition":"指定表示默认值的字符串，与 COPY 的 DEFAULT 选项相同。","name":"default"},{"definition":"指定数据编码，与 COPY 的 ENCODING 选项相同。","name":"encoding"},{"definition":"指定在将列输入值转换为其数据类型时遇到错误的处理方式，与 COPY 的 ON_ERROR 选项相同。","name":"on_error"},{"definition":"指定在将列输入值转换为其数据类型时可容忍的最大错误数，与 COPY 的 REJECT_LIMIT 选项相同。","name":"reject_limit"},{"definition":"指定 file_fdw 发出消息的详细程度，与 COPY 的 LOG_VERBOSITY 选项相同。","name":"log_verbosity"},{"definition":"这是一个布尔选项。如果为真，它指定该列的值不应与空值串（即表级的 null 选项）匹配。其效果与在 COPY 的 FORCE_NOT_NULL 选项中列出该列相同。","name":"force_not_null"},{"definition":"这是一个布尔选项。如果为真，它指定该列中与空值串匹配的值即使带有引号，也会作为 NULL 返回。没有此选项时，只有未加引号且与空值串匹配的值才会作为 NULL 返回。其效果与在 COPY 的 FORCE_NULL 选项中列出该列相同。","name":"force_null"}],"title":"手册中的选项"}],"zh_from":{"authored_translation":"source-derived-identity","body_sha256":"a63e48f8f0ee5601e790cb9c62cae6872b510f606e221cbdbb6399c1a500c2c6","kind":"same-version-chinese-manual-with-source-derived-identity","manual":{"anchor":"","build_id":107,"extraction":"concept-introduction","fragment_sha256":"78e686f67ea32d631aefdcc6d2f2b7516f98387dcd1b452036545ed6096915df","locale":"zh-Hans","page_key":"file-fdw.html","source_hash":"551fbb9eeda7191c5fa4931c57b450e30db27a6769739cb36e60a2f383596cee","source_revision":"unknown:rendered-translation-baseline","translated_from_revision":null,"translation_revision":"git:b1b500221dbe5437cfca004d6b04d3f6e422765d;html-sha256:08e987a66af27b98444a8057c256314eafa13611a3fb9e888214fc436824244b","url":"/zh/docs/18/file-fdw.html","version":"18"},"runtime_rerun":false,"source_facts_revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}},"ManualEvidence":{"manual_path":"/docs/18/file-fdw.html","release":{"channel":"stable","label":"18.6","major":"18","ref":"PostgreSQL 18.6 source archive","revision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","source_snapshot_utc":"","source_url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"},"sources":[{"label":"PostgreSQL 18 English manual","path":"file-fdw.html","sha256":"5da35cee02e73ec6656a2020d8351046cad9283a137b45064bee58f1ff7eb787","url":"/docs/18/file-fdw.html"},{"archive_sha256":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","label":"contrib/file_fdw/file_fdw.c:183","line":183,"path":"contrib/file_fdw/file_fdw.c","sha256":"d79ec21c08be6a806b0710aab09698678ddb24103d3470702e66ee1523432125","url":"https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2"}]},"MeasuredEvidence":{"runtime_verified":false}},"Text":{"Collection":"fdw","Key":"file_fdw","SourceDatabase":"center","Version":"18","Locale":"en","Title":"file_fdw","Summary":"Reads server-side files or program output through the foreign-data wrapper interface.","BodyHTML":"\u003cdiv id=\"FILE-FDW\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch2\u003eF.15. file_fdw — access data files in the server\u0026#39;s file system \u003c/h2\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eThe \u003ccode\u003efile_fdw\u003c/code\u003e module provides the foreign-data wrapper \u003ccode\u003efile_fdw\u003c/code\u003e, which can be used to access data files in the server\u0026#39;s file system, or to execute programs on the server and read their output. The data file or program output must be in a format that can be read by \u003ccode\u003eCOPY FROM\u003c/code\u003e; see \u003ca href=\"/docs/18/sql-copy.html\" title=\"COPY\" rel=\"nofollow\"\u003e\u003cspan\u003eCOPY\u003c/span\u003e\u003c/a\u003e for details. Access to data files is currently read-only.\u003c/p\u003e\n\u003cp\u003eA foreign table created using this wrapper can have the following options:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003efilename\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the file to be read. Relative paths are relative to the data directory. Either \u003ccode\u003efilename\u003c/code\u003e or \u003ccode\u003eprogram\u003c/code\u003e must be specified, but not both.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eprogram\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the command to be executed. The standard output of this command will be read as though \u003ccode\u003eCOPY FROM PROGRAM\u003c/code\u003e were used. Either \u003ccode\u003eprogram\u003c/code\u003e or \u003ccode\u003efilename\u003c/code\u003e must be specified, but not both.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eformat\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data format, the same as \u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eFORMAT\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eheader\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether the data has a header line, the same as \u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eHEADER\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003edelimiter\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data delimiter character, the same as \u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eDELIMITER\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003equote\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data quote character, the same as \u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eQUOTE\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eescape\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data escape character, the same as \u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eESCAPE\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003enull\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data null string, the same as \u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eNULL\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003edefault\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the string that represents a default value, the same as \u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eDEFAULT\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data encoding, the same as \u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eENCODING\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eon_error\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies how to behave when encountering an error converting a column\u0026#39;s input value into its data type, the same as \u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eON_ERROR\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003ereject_limit\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the maximum number of errors tolerated while converting a column\u0026#39;s input value to its data type, the same as \u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eREJECT_LIMIT\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003elog_verbosity\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the amount of messages emitted by \u003ccode\u003efile_fdw\u003c/code\u003e, the same as \u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eLOG_VERBOSITY\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eNote that while \u003ccode\u003eCOPY\u003c/code\u003e allows options such as \u003ccode\u003eHEADER\u003c/code\u003e to be specified without a corresponding value, the foreign table option syntax requires a value to be present in all cases. To activate \u003ccode\u003eCOPY\u003c/code\u003e options typically written without a value, you can pass the value TRUE, since all such options are Booleans.\u003c/p\u003e\n\u003cp\u003eA column of a foreign table created using this wrapper can have the following options:\u003c/p\u003e\n\u003cdiv\u003e\n\u003cdl\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eforce_not_null\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is a Boolean option. If true, it specifies that values of the column should not be matched against the null string (that is, the table-level \u003ccode\u003enull\u003c/code\u003e option). This has the same effect as listing the column in \u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eFORCE_NOT_NULL\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eforce_null\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is a Boolean option. If true, it specifies that values of the column which match the null string are returned as \u003ccode\u003eNULL\u003c/code\u003e even if the value is quoted. Without this option, only unquoted values matching the null string are returned as \u003ccode\u003eNULL\u003c/code\u003e. This has the same effect as listing the column in \u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eFORCE_NULL\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ccode\u003eCOPY\u003c/code\u003e\u0026#39;s \u003ccode\u003eFORCE_QUOTE\u003c/code\u003e option is currently not supported by \u003ccode\u003efile_fdw\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThese options can only be specified for a foreign table or its columns, not in the options of the \u003ccode\u003efile_fdw\u003c/code\u003e foreign-data wrapper, nor in the options of a server or user mapping using the wrapper.\u003c/p\u003e\n\u003cp\u003eChanging table-level options requires being a superuser or having the privileges of the role \u003ccode\u003epg_read_server_files\u003c/code\u003e (to use a filename) or the role \u003ccode\u003epg_execute_server_program\u003c/code\u003e (to use a program), for security reasons: only certain users should be able to control which file is read or which program is run. In principle regular users could be allowed to change the other options, but that\u0026#39;s not supported at present.\u003c/p\u003e\n\u003cp\u003eWhen specifying the \u003ccode\u003eprogram\u003c/code\u003e option, keep in mind that the option string is executed by the shell. If you need to pass any arguments to the command that come from an untrusted source, you must be careful to strip or escape any characters that might have special meaning to the shell. For security reasons, it is best to use a fixed command string, or at least avoid passing any user input in it.\u003c/p\u003e\n\u003cp\u003eFor a foreign table using \u003ccode\u003efile_fdw\u003c/code\u003e, \u003ccode\u003eEXPLAIN\u003c/code\u003e shows the name of the file to be read or program to be run. For a file, unless \u003ccode\u003eCOSTS OFF\u003c/code\u003e is specified, the file size (in bytes) is shown as well.\u003c/p\u003e\n\u003cdiv id=\"id-1.11.7.25.14\"\u003e\n\u003cp\u003e\u003cstrong\u003eExample F.1. Create a Foreign Table for PostgreSQL CSV Logs\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv\u003e\n\u003cp\u003eOne of the obvious uses for \u003ccode\u003efile_fdw\u003c/code\u003e is to make the PostgreSQL activity log available as a table for querying. To do this, first you must be \u003ca href=\"/docs/18/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-CSVLOG\" rel=\"nofollow\"\u003elogging to a CSV file,\u003c/a\u003e which here we will call \u003ccode\u003epglog.csv\u003c/code\u003e. First, install \u003ccode\u003efile_fdw\u003c/code\u003e as an extension:\u003c/p\u003e\n\u003cpre\u003eCREATE EXTENSION file_fdw;\n\u003c/pre\u003e\n\u003cp\u003eThen create a foreign server:\u003c/p\u003e\n\u003cpre\u003eCREATE SERVER pglog FOREIGN DATA WRAPPER file_fdw;\n\u003c/pre\u003e\n\u003cp\u003eNow you are ready to create the foreign data table. Using the \u003ccode\u003eCREATE FOREIGN TABLE\u003c/code\u003e command, you will need to define the columns for the table, the CSV file name, and its format:\u003c/p\u003e\n\u003cpre\u003eCREATE FOREIGN TABLE pglog (\n  log_time timestamp(3) with time zone,\n  user_name text,\n  database_name text,\n  process_id integer,\n  connection_from text,\n  session_id text,\n  session_line_num bigint,\n  command_tag text,\n  session_start_time timestamp with time zone,\n  virtual_transaction_id text,\n  transaction_id bigint,\n  error_severity text,\n  sql_state_code text,\n  message text,\n  detail text,\n  hint text,\n  internal_query text,\n  internal_query_pos integer,\n  context text,\n  query text,\n  query_pos integer,\n  location text,\n  application_name text,\n  backend_type text,\n  leader_pid integer,\n  query_id bigint\n) SERVER pglog\nOPTIONS ( filename \u0026#39;log/pglog.csv\u0026#39;, format \u0026#39;csv\u0026#39; );\n\u003c/pre\u003e\n\u003cp\u003eThat\u0026#39;s it — now you can query your log directly. In production, of course, you would need to define some way to deal with log rotation.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr\u003e\n\u003cdiv id=\"id-1.11.7.25.15\"\u003e\n\u003cp\u003e\u003cstrong\u003eExample F.2. Create a Foreign Table with an Option on a Column\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv\u003e\n\u003cp\u003eTo set the \u003ccode\u003eforce_null\u003c/code\u003e option for a column, use the \u003ccode\u003eOPTIONS\u003c/code\u003e keyword.\u003c/p\u003e\n\u003cpre\u003eCREATE FOREIGN TABLE films (\n code char(5) NOT NULL,\n title text NOT NULL,\n rating text OPTIONS (force_null \u0026#39;true\u0026#39;)\n) SERVER film_server\nOPTIONS ( filename \u0026#39;films/db.csv\u0026#39;, format \u0026#39;csv\u0026#39; );\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr\u003e\n\u003c/div\u003e","SourceRevision":"555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f","ContentHash":"89275d1960845d8abf81e25ea510237a64022e52e9f2adc3ce0c0025aeade3ca","Payload":{"description":["Reads server-side files or program output through the foreign-data wrapper interface."],"manual_html":"\u003cdiv class=\"sect1\" id=\"FILE-FDW\"\u003e\n\u003cdiv class=\"titlepage\"\u003e\n\u003cdiv\u003e\n\u003cdiv\u003e\n\u003ch2 class=\"title\"\u003eF.15. file_fdw — access data files in the server's file system \u003c/h2\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003c/div\u003e\n\u003cp\u003eThe \u003ccode class=\"filename\"\u003efile_fdw\u003c/code\u003e module provides the foreign-data wrapper \u003ccode class=\"function\"\u003efile_fdw\u003c/code\u003e, which can be used to access data files in the server's file system, or to execute programs on the server and read their output. The data file or program output must be in a format that can be read by \u003ccode class=\"command\"\u003eCOPY FROM\u003c/code\u003e; see \u003ca class=\"xref\" href=\"/docs/18/sql-copy.html\" title=\"COPY\"\u003e\u003cspan class=\"refentrytitle\"\u003eCOPY\u003c/span\u003e\u003c/a\u003e for details. Access to data files is currently read-only.\u003c/p\u003e\n\u003cp\u003eA foreign table created using this wrapper can have the following options:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003efilename\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the file to be read. Relative paths are relative to the data directory. Either \u003ccode class=\"literal\"\u003efilename\u003c/code\u003e or \u003ccode class=\"literal\"\u003eprogram\u003c/code\u003e must be specified, but not both.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eprogram\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the command to be executed. The standard output of this command will be read as though \u003ccode class=\"command\"\u003eCOPY FROM PROGRAM\u003c/code\u003e were used. Either \u003ccode class=\"literal\"\u003eprogram\u003c/code\u003e or \u003ccode class=\"literal\"\u003efilename\u003c/code\u003e must be specified, but not both.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eformat\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data format, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eFORMAT\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eheader\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies whether the data has a header line, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eHEADER\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003edelimiter\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data delimiter character, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eDELIMITER\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003equote\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data quote character, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eQUOTE\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eescape\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data escape character, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eESCAPE\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003enull\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data null string, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003edefault\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the string that represents a default value, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eDEFAULT\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eencoding\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the data encoding, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eENCODING\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eon_error\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies how to behave when encountering an error converting a column's input value into its data type, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eON_ERROR\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003ereject_limit\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the maximum number of errors tolerated while converting a column's input value to its data type, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eREJECT_LIMIT\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003elog_verbosity\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eSpecifies the amount of messages emitted by \u003ccode class=\"literal\"\u003efile_fdw\u003c/code\u003e, the same as \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eLOG_VERBOSITY\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003eNote that while \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e allows options such as \u003ccode class=\"literal\"\u003eHEADER\u003c/code\u003e to be specified without a corresponding value, the foreign table option syntax requires a value to be present in all cases. To activate \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e options typically written without a value, you can pass the value TRUE, since all such options are Booleans.\u003c/p\u003e\n\u003cp\u003eA column of a foreign table created using this wrapper can have the following options:\u003c/p\u003e\n\u003cdiv class=\"variablelist\"\u003e\n\u003cdl class=\"variablelist\"\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eforce_not_null\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is a Boolean option. If true, it specifies that values of the column should not be matched against the null string (that is, the table-level \u003ccode class=\"literal\"\u003enull\u003c/code\u003e option). This has the same effect as listing the column in \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eFORCE_NOT_NULL\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eforce_null\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\n\u003cdd\u003e\n\u003cp\u003eThis is a Boolean option. If true, it specifies that values of the column which match the null string are returned as \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e even if the value is quoted. Without this option, only unquoted values matching the null string are returned as \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e. This has the same effect as listing the column in \u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eFORCE_NULL\u003c/code\u003e option.\u003c/p\u003e\n\u003c/dd\u003e\n\u003c/dl\u003e\n\u003c/div\u003e\n\u003cp\u003e\u003ccode class=\"command\"\u003eCOPY\u003c/code\u003e's \u003ccode class=\"literal\"\u003eFORCE_QUOTE\u003c/code\u003e option is currently not supported by \u003ccode class=\"literal\"\u003efile_fdw\u003c/code\u003e.\u003c/p\u003e\n\u003cp\u003eThese options can only be specified for a foreign table or its columns, not in the options of the \u003ccode class=\"literal\"\u003efile_fdw\u003c/code\u003e foreign-data wrapper, nor in the options of a server or user mapping using the wrapper.\u003c/p\u003e\n\u003cp\u003eChanging table-level options requires being a superuser or having the privileges of the role \u003ccode class=\"literal\"\u003epg_read_server_files\u003c/code\u003e (to use a filename) or the role \u003ccode class=\"literal\"\u003epg_execute_server_program\u003c/code\u003e (to use a program), for security reasons: only certain users should be able to control which file is read or which program is run. In principle regular users could be allowed to change the other options, but that's not supported at present.\u003c/p\u003e\n\u003cp\u003eWhen specifying the \u003ccode class=\"literal\"\u003eprogram\u003c/code\u003e option, keep in mind that the option string is executed by the shell. If you need to pass any arguments to the command that come from an untrusted source, you must be careful to strip or escape any characters that might have special meaning to the shell. For security reasons, it is best to use a fixed command string, or at least avoid passing any user input in it.\u003c/p\u003e\n\u003cp\u003eFor a foreign table using \u003ccode class=\"literal\"\u003efile_fdw\u003c/code\u003e, \u003ccode class=\"command\"\u003eEXPLAIN\u003c/code\u003e shows the name of the file to be read or program to be run. For a file, unless \u003ccode class=\"literal\"\u003eCOSTS OFF\u003c/code\u003e is specified, the file size (in bytes) is shown as well.\u003c/p\u003e\n\u003cdiv class=\"example\" id=\"id-1.11.7.25.14\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eExample F.1. Create a Foreign Table for PostgreSQL CSV Logs\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"example-contents\"\u003e\n\u003cp\u003eOne of the obvious uses for \u003ccode class=\"literal\"\u003efile_fdw\u003c/code\u003e is to make the PostgreSQL activity log available as a table for querying. To do this, first you must be \u003ca class=\"link\" href=\"/docs/18/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-CSVLOG\" title=\"19.8.4. Using CSV-Format Log Output\"\u003elogging to a CSV file,\u003c/a\u003e which here we will call \u003ccode class=\"literal\"\u003epglog.csv\u003c/code\u003e. First, install \u003ccode class=\"literal\"\u003efile_fdw\u003c/code\u003e as an extension:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eCREATE EXTENSION file_fdw;\n\u003c/pre\u003e\n\u003cp\u003eThen create a foreign server:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eCREATE SERVER pglog FOREIGN DATA WRAPPER file_fdw;\n\u003c/pre\u003e\n\u003cp\u003eNow you are ready to create the foreign data table. Using the \u003ccode class=\"command\"\u003eCREATE FOREIGN TABLE\u003c/code\u003e command, you will need to define the columns for the table, the CSV file name, and its format:\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eCREATE FOREIGN TABLE pglog (\n  log_time timestamp(3) with time zone,\n  user_name text,\n  database_name text,\n  process_id integer,\n  connection_from text,\n  session_id text,\n  session_line_num bigint,\n  command_tag text,\n  session_start_time timestamp with time zone,\n  virtual_transaction_id text,\n  transaction_id bigint,\n  error_severity text,\n  sql_state_code text,\n  message text,\n  detail text,\n  hint text,\n  internal_query text,\n  internal_query_pos integer,\n  context text,\n  query text,\n  query_pos integer,\n  location text,\n  application_name text,\n  backend_type text,\n  leader_pid integer,\n  query_id bigint\n) SERVER pglog\nOPTIONS ( filename 'log/pglog.csv', format 'csv' );\n\u003c/pre\u003e\n\u003cp\u003eThat's it — now you can query your log directly. In production, of course, you would need to define some way to deal with log rotation.\u003c/p\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"example-break\"\u003e\n\u003cdiv class=\"example\" id=\"id-1.11.7.25.15\"\u003e\n\u003cp class=\"title\"\u003e\u003cstrong\u003eExample F.2. Create a Foreign Table with an Option on a Column\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv class=\"example-contents\"\u003e\n\u003cp\u003eTo set the \u003ccode class=\"literal\"\u003eforce_null\u003c/code\u003e option for a column, use the \u003ccode class=\"literal\"\u003eOPTIONS\u003c/code\u003e keyword.\u003c/p\u003e\n\u003cpre class=\"programlisting\"\u003eCREATE FOREIGN TABLE films (\n code char(5) NOT NULL,\n title text NOT NULL,\n rating text OPTIONS (force_null 'true')\n) SERVER film_server\nOPTIONS ( filename 'films/db.csv', format 'csv' );\n\u003c/pre\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003cbr class=\"example-break\"\u003e\n\u003c/div\u003e","related":[{"label":"Foreign-data wrapper catalog","url":"/wiki/catalog/pg_foreign_data_wrapper/?v=18"},{"label":"Existing extension catalogue identity","url":"/e/file_fdw/"},{"label":"Foreign Scan plan node","url":"/wiki/plan/foreign-scan/?v=18"}],"sections":[{"paragraphs":["The matrix records callbacks actually registered in this source build. Registration identifies an implemented interface hook; options, query shape, privileges and provider rules determine whether an operation is allowed.","The complete same-version manual below retains configuration, constraints and examples. No runtime capability test is claimed."],"title":"Interface and capability boundaries"},{"paragraphs":["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, or to execute programs on the server and read their output. The data file or program output must be in a format that can be read by COPY FROM ; see COPY for details. Access to data files is currently read-only."],"title":"File access boundary"},{"code":"{\n\tFdwRoutine *fdwroutine = makeNode(FdwRoutine);\n\n\tfdwroutine-\u003eGetForeignRelSize = fileGetForeignRelSize;\n\tfdwroutine-\u003eGetForeignPaths = fileGetForeignPaths;\n\tfdwroutine-\u003eGetForeignPlan = fileGetForeignPlan;\n\tfdwroutine-\u003eExplainForeignScan = fileExplainForeignScan;\n\tfdwroutine-\u003eBeginForeignScan = fileBeginForeignScan;\n\tfdwroutine-\u003eIterateForeignScan = fileIterateForeignScan;\n\tfdwroutine-\u003eReScanForeignScan = fileReScanForeignScan;\n\tfdwroutine-\u003eEndForeignScan = fileEndForeignScan;\n\tfdwroutine-\u003eAnalyzeForeignTable = fileAnalyzeForeignTable;\n\tfdwroutine-\u003eIsForeignScanParallelSafe = fileIsForeignScanParallelSafe;\n\n\tPG_RETURN_POINTER(fdwroutine);\n}","title":"Registered implementation in core source"}],"tables":[{"columns":[{"key":"feature","label":"Interface operation"},{"key":"state","label":"Source observation"},{"key":"callback","label":"Callback"},{"key":"implementation","label":"Implementation"}],"key":"callbacks","rows":[{"callback":"IterateForeignScan","feature":"Scan rows","implementation":"fileIterateForeignScan","state":"Handler registered; conditions apply"},{"callback":"ExecForeignInsert","feature":"INSERT","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"ExecForeignUpdate","feature":"UPDATE","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"ExecForeignDelete","feature":"DELETE","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"ExecForeignTruncate","feature":"TRUNCATE","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"GetForeignJoinPaths","feature":"Join path pushdown","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"GetForeignUpperPaths","feature":"Upper paths, including aggregation","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"ExecForeignBatchInsert","feature":"Batch insert","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"ForeignAsyncRequest","feature":"Asynchronous append execution","implementation":"Not registered","state":"No handler registered in this build"},{"callback":"ImportForeignSchema","feature":"Import schema","implementation":"Not registered","state":"No handler registered in this build"}],"title":"Registered interface handlers"},{"columns":[{"key":"name","label":"Option"},{"key":"definition","label":"Same-version definition"}],"key":"options","rows":[{"definition":"Specifies the file to be read. Relative paths are relative to the data directory. Either filename or program must be specified, but not both.","name":"filename"},{"definition":"Specifies the command to be executed. The standard output of this command will be read as though COPY FROM PROGRAM were used. Either program or filename must be specified, but not both.","name":"program"},{"definition":"Specifies the data format, the same as COPY 's FORMAT option.","name":"format"},{"definition":"Specifies whether the data has a header line, the same as COPY 's HEADER option.","name":"header"},{"definition":"Specifies the data delimiter character, the same as COPY 's DELIMITER option.","name":"delimiter"},{"definition":"Specifies the data quote character, the same as COPY 's QUOTE option.","name":"quote"},{"definition":"Specifies the data escape character, the same as COPY 's ESCAPE option.","name":"escape"},{"definition":"Specifies the data null string, the same as COPY 's NULL option.","name":"null"},{"definition":"Specifies the string that represents a default value, the same as COPY 's DEFAULT option.","name":"default"},{"definition":"Specifies the data encoding, the same as COPY 's ENCODING option.","name":"encoding"},{"definition":"Specifies how to behave when encountering an error converting a column's input value into its data type, the same as COPY 's ON_ERROR option.","name":"on_error"},{"definition":"Specifies the maximum number of errors tolerated while converting a column's input value to its data type, the same as COPY 's REJECT_LIMIT option.","name":"reject_limit"},{"definition":"Specifies the amount of messages emitted by file_fdw , the same as COPY 's LOG_VERBOSITY option.","name":"log_verbosity"},{"definition":"This is a Boolean option. If true, it specifies that values of the column should not be matched against the null string (that is, the table-level null option). This has the same effect as listing the column in COPY 's FORCE_NOT_NULL option.","name":"force_not_null"},{"definition":"This is a Boolean option. If true, it specifies that values of the column which match the null string are returned as NULL even if the value is quoted. Without this option, only unquoted values matching the null string are returned as NULL . This has the same effect as listing the column in COPY 's FORCE_NULL option.","name":"force_null"}],"title":"Documented options"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
