Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
doc: Add example for how to set file_fdw column option
authorDaniel Gustafsson <dgustafsson@postgresql.org>
Mon, 18 Sep 2023 12:59:16 +0000 (14:59 +0200)
committerDaniel Gustafsson <dgustafsson@postgresql.org>
Mon, 18 Sep 2023 12:59:16 +0000 (14:59 +0200)
The documentation is pretty light on how to set column options
on foreign tables, and the file_fdw docs refer to COPY when
documenting force_null even though it's not used in the same
way. Add a small example to describe how to use it.

Reported-by: Boshomi Phenix <boshomi@gmail.com>
Discussion: https://postgr.es/m/CAJVkCUparn4_Oarernm=U6LWVsTkecKcALHtwGr5M3qJRj_czw@mail.gmail.com

doc/src/sgml/file-fdw.sgml

index 56d696c323c3da2f40fe58b6292add7971574379..b7f64930f06f7c3abde62f83d882c82a5cd1f86b 100644 (file)
@@ -279,4 +279,20 @@ OPTIONS ( filename 'log/pglog.csv', format 'csv' );
   </para>
  </example>
 
+ <example>
+  <title>Create a Foreign Table with an option on a column</title>
+  <para>
+   To set the <literal>force_null</literal> option for a column, use the
+   <literal>OPTIONS</literal> keyword.
+  </para>
+<programlisting>
+CREATE FOREIGN TABLE films (
+ code char(5) NOT NULL,
+ title text NOT NULL,
+ rating text OPTIONS (force_null 'true')
+) SERVER film_server
+OPTIONS ( filename 'films/db.csv', format 'csv' );
+</programlisting>
+ </example>
+
 </sect1>