Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/file-fdw.sgml`
81612b81531b40bd5e2cd2d1dd8a56a845a8fd160ebc9d180000000100000d0c
 </listitem>
  </varlistentry>

  <varlistentry>
   <term><literal>encoding</literal></term>

   <listitem>
    <para>
     Specifies the data encoding,
     the same as <command>COPY</command>'s <literal>ENCODING</literal> option.
    </para>
   </listitem>
  </varlistentry>

  <varlistentry>
   <term><literal>on_error</literal></term>

   <listitem>
    <para>
     Specifies how to behave when encountering an error converting a column's
     input value into its data type,
     the same as <command>COPY</command>'s <literal>ON_ERROR</literal> option.
    </para>
   </listitem>
  </varlistentry>

  <varlistentry>
   <term><literal>reject_limit</literal></term>

   <listitem>
    <para>
     Specifies the maximum number of errors tolerated while converting a column's
     input value to its data type, the same as <command>COPY</command>'s
    <literal>REJECT_LIMIT</literal> option.
    </para>
   </listitem>
  </varlistentry>

  <varlistentry>
   <term><literal>log_verbosity</literal></term>

   <listitem>
    <para>
     Specifies the amount of messages emitted by <literal>file_fdw</literal>,
     the same as <command>COPY</command>'s <literal>LOG_VERBOSITY</literal> option.
    </para>
   </listitem>
  </varlistentry>

 </variablelist>

 <para>
  Note that while <command>COPY</command> allows options such as <literal>HEADER</literal>
  to be specified without a corresponding value, the foreign table option
  syntax requires a value to be present in all cases.  To activate
  <command>COPY</command> options typically written without a value, you can pass
  the value TRUE, since all such options are Booleans.
 </para>

 <para>
  A column of a foreign table created using this wrapper can have the
  following options:
 </para>

 <variablelist>

  <varlistentry>
   <term><literal>force_not_null</literal></term>

   <listitem>
    <para>
     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 <literal>null</literal> option).  This has the same effect
     as listing the column in <command>COPY</command>'s
     <literal>FORCE_NOT_NULL</literal> option.
    </para>
   </listitem>
  </varlistentry>

  <varlistentry>
   <term><literal>force_null</literal></term>

   <listitem>
    <para>
     This is a Boolean option.  If true, it specifies that values of the
     column which match the null string are returned as <literal>NULL</literal>
     even if the value is quoted. Without this option, only unquoted
     values matching the null string are returned as <literal>NULL</literal>.
     This has the same effect  as listing the column in
     <command>COPY</command>'s <literal>FORCE_NULL</literal> option.
    </para>
   </listitem>
  </varlistentry>

 </variablelist>

 <para>
  <command>COPY</command>'s <literal>FORCE_QUOTE</literal> option is
  currently not supported by <literal>file_fdw</literal>.
 </para>

 <para>
  These options can only be specified for a foreign table or its columns, not
  in the options of the <literal>file_fdw</literal> foreign-data wrapper, nor in the
  options of a server or user mapping using the wrapper.
 </para>

 <para>
  Changing table-level options requires being a superuser or having the privileges
  of the role <literal>pg_read_server_files</literal>

Title: file_fdw Options and Column Options
Summary
The file_fdw module allows specifying options like log_verbosity, encoding, on_error and reject_limit. Options such as HEADER must be passed a boolean value. Additionally, column-specific options like force_not_null and force_null can be defined, mimicking COPY's FORCE_NOT_NULL and FORCE_NULL options. COPY's FORCE_QUOTE is not supported. Options are specified at the table or column level, not on the foreign-data wrapper, server, or user mapping. Changing table-level options requires superuser or pg_read_server_files privileges.