~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to doc/src/sgml/file-fdw.sgml

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!-- doc/src/sgml/file-fdw.sgml -->
 
2
 
 
3
<sect1 id="file-fdw">
 
4
 <title>file_fdw</title>
 
5
 
 
6
 <indexterm zone="file-fdw">
 
7
  <primary>file_fdw</primary>
 
8
 </indexterm>
 
9
 
 
10
 <para>
 
11
  The <filename>file_fdw</> module provides the foreign-data wrapper
 
12
  <function>file_fdw</function>, which can be used to access data
 
13
  files in the server's filesystem.  Data files must be in a format
 
14
  that can be read by <command>COPY FROM</command>;
 
15
  see <xref linkend="sql-copy"> for details.
 
16
 </para>
 
17
 
 
18
 <para>
 
19
  A foreign table created using this wrapper can have the following options:
 
20
 </para>
 
21
 
 
22
 <variablelist>
 
23
 
 
24
  <varlistentry>
 
25
   <term><literal>filename</literal></term>
 
26
 
 
27
   <listitem>
 
28
    <para>
 
29
     Specifies the file to be read.  Required.  Must be an absolute path name.
 
30
    </para>
 
31
   </listitem>
 
32
  </varlistentry>
 
33
 
 
34
  <varlistentry>
 
35
   <term><literal>format</literal></term>
 
36
 
 
37
   <listitem>
 
38
    <para>
 
39
     Specifies the file's format,
 
40
     the same as <command>COPY</>'s <literal>FORMAT</literal> option.
 
41
    </para>
 
42
   </listitem>
 
43
  </varlistentry>
 
44
 
 
45
  <varlistentry>
 
46
   <term><literal>header</literal></term>
 
47
 
 
48
   <listitem>
 
49
    <para>
 
50
     Specifies whether the file has a header line,
 
51
     the same as <command>COPY</>'s <literal>HEADER</literal> option.
 
52
    </para>
 
53
   </listitem>
 
54
  </varlistentry>
 
55
 
 
56
  <varlistentry>
 
57
   <term><literal>delimiter</literal></term>
 
58
 
 
59
   <listitem>
 
60
    <para>
 
61
     Specifies the file's delimiter character,
 
62
     the same as <command>COPY</>'s <literal>DELIMITER</literal> option.
 
63
    </para>
 
64
   </listitem>
 
65
  </varlistentry>
 
66
 
 
67
  <varlistentry>
 
68
   <term><literal>quote</literal></term>
 
69
 
 
70
   <listitem>
 
71
    <para>
 
72
     Specifies the file's quote character,
 
73
     the same as <command>COPY</>'s <literal>QUOTE</literal> option.
 
74
    </para>
 
75
   </listitem>
 
76
  </varlistentry>
 
77
 
 
78
  <varlistentry>
 
79
   <term><literal>escape</literal></term>
 
80
 
 
81
   <listitem>
 
82
    <para>
 
83
     Specifies the file's escape character,
 
84
     the same as <command>COPY</>'s <literal>ESCAPE</literal> option.
 
85
    </para>
 
86
   </listitem>
 
87
  </varlistentry>
 
88
 
 
89
  <varlistentry>
 
90
   <term><literal>null</literal></term>
 
91
 
 
92
   <listitem>
 
93
    <para>
 
94
     Specifies the file's null string,
 
95
     the same as <command>COPY</>'s <literal>NULL</literal> option.
 
96
    </para>
 
97
   </listitem>
 
98
  </varlistentry>
 
99
 
 
100
  <varlistentry>
 
101
   <term><literal>encoding</literal></term>
 
102
 
 
103
   <listitem>
 
104
    <para>
 
105
     Specifies the file's encoding.
 
106
     the same as <command>COPY</>'s <literal>ENCODING</literal> option.
 
107
    </para>
 
108
   </listitem>
 
109
  </varlistentry>
 
110
 
 
111
 </variablelist>
 
112
 
 
113
 <para>
 
114
  <command>COPY</>'s <literal>OIDS</literal>, <literal>FORCE_QUOTE</literal>,
 
115
  and <literal>FORCE_NOT_NULL</literal> options are currently not supported by
 
116
  <literal>file_fdw</>.
 
117
 </para>
 
118
 
 
119
 <para>
 
120
  These options can only be specified for a foreign table, not in the
 
121
  options of the <literal>file_fdw</> foreign-data wrapper, nor in the
 
122
  options of a server or user mapping using the wrapper.
 
123
 </para>
 
124
 
 
125
 <para>
 
126
  Changing table-level options requires superuser privileges, for security
 
127
  reasons: only a superuser should be able to determine which file is read.
 
128
  In principle non-superusers could be allowed to change the other options,
 
129
  but that's not supported at present.
 
130
 </para>
 
131
 
 
132
 <para>
 
133
  For a foreign table using <literal>file_fdw</>, <command>EXPLAIN</> shows
 
134
  the name of the file to be read.  Unless <literal>COSTS OFF</> is
 
135
  specified, the file size (in bytes) is shown as well.
 
136
 </para>
 
137
 
 
138
</sect1>