1
by Martin Pitt
Import upstream version 9.1~beta1 |
1 |
<!--
|
2 |
doc/src/sgml/ref/pg_dump.sgml
|
|
3 |
PostgreSQL documentation
|
|
4 |
-->
|
|
5 |
||
6 |
<refentry id="APP-PGDUMP"> |
|
7 |
<refmeta>
|
|
8 |
<refentrytitle>pg_dump</refentrytitle> |
|
9 |
<manvolnum>1</manvolnum> |
|
10 |
<refmiscinfo>Application</refmiscinfo> |
|
11 |
</refmeta>
|
|
12 |
||
13 |
<refnamediv>
|
|
14 |
<refname>pg_dump</refname> |
|
15 |
||
16 |
<refpurpose>
|
|
17 |
extract a <productname>PostgreSQL</productname> database into a script file or other archive file |
|
18 |
</refpurpose>
|
|
19 |
</refnamediv>
|
|
20 |
||
21 |
<indexterm zone="app-pgdump"> |
|
22 |
<primary>pg_dump</primary> |
|
23 |
</indexterm>
|
|
24 |
||
25 |
<refsynopsisdiv>
|
|
26 |
<cmdsynopsis>
|
|
27 |
<command>pg_dump</command> |
|
28 |
<arg rep="repeat"><replaceable>connection-option</replaceable></arg> |
|
29 |
<arg rep="repeat"><replaceable>option</replaceable></arg> |
|
30 |
<arg><replaceable>dbname</replaceable></arg> |
|
31 |
</cmdsynopsis>
|
|
32 |
</refsynopsisdiv>
|
|
33 |
||
34 |
||
35 |
<refsect1 id="pg-dump-description"> |
|
36 |
<title>
|
|
37 |
Description |
|
38 |
</title>
|
|
39 |
||
40 |
<para>
|
|
41 |
<application>pg_dump</application> is a utility for backing up a |
|
42 |
<productname>PostgreSQL</productname> database. It makes consistent |
|
43 |
backups even if the database is being used concurrently. |
|
44 |
<application>pg_dump</application> does not block other users |
|
45 |
accessing the database (readers or writers). |
|
46 |
</para>
|
|
47 |
||
48 |
<para>
|
|
49 |
Dumps can be output in script or archive file formats. Script |
|
50 |
dumps are plain-text files containing the SQL commands required |
|
51 |
to reconstruct the database to the state it was in at the time it was |
|
52 |
saved. To restore from such a script, feed it to <xref
|
|
53 |
linkend="app-psql">. Script files |
|
54 |
can be used to reconstruct the database even on other machines and |
|
55 |
other architectures; with some modifications, even on other SQL |
|
56 |
database products. |
|
57 |
</para>
|
|
58 |
||
59 |
<para>
|
|
60 |
The alternative archive file formats must be used with |
|
61 |
<xref linkend="app-pgrestore"> to rebuild the database. They |
|
62 |
allow <application>pg_restore</application> to be selective about |
|
63 |
what is restored, or even to reorder the items prior to being |
|
64 |
restored. |
|
65 |
The archive file formats are designed to be portable across |
|
66 |
architectures. |
|
67 |
</para>
|
|
68 |
||
69 |
<para>
|
|
70 |
When used with one of the archive file formats and combined with |
|
71 |
<application>pg_restore</application>, |
|
72 |
<application>pg_dump</application> provides a flexible archival and |
|
73 |
transfer mechanism. <application>pg_dump</application> can be used to |
|
74 |
backup an entire database, then <application>pg_restore</application> |
|
75 |
can be used to examine the archive and/or select which parts of the |
|
76 |
database are to be restored. The most flexible output file format is |
|
77 |
the <quote>custom</quote> format (<option>-Fc</option>). It allows |
|
78 |
for selection and reordering of all archived items, and is compressed |
|
79 |
by default. |
|
80 |
</para>
|
|
81 |
||
82 |
<para>
|
|
83 |
While running <application>pg_dump</application>, one should examine the |
|
84 |
output for any warnings (printed on standard error), especially in |
|
85 |
light of the limitations listed below. |
|
86 |
</para>
|
|
87 |
||
88 |
</refsect1>
|
|
89 |
||
90 |
<refsect1 id="pg-dump-options"> |
|
91 |
<title>Options</title> |
|
92 |
||
93 |
<para>
|
|
94 |
The following command-line options control the content and |
|
95 |
format of the output. |
|
96 |
||
97 |
<variablelist>
|
|
98 |
<varlistentry>
|
|
99 |
<term><replaceable class="parameter">dbname</replaceable></term> |
|
100 |
<listitem>
|
|
101 |
<para>
|
|
102 |
Specifies the name of the database to be dumped. If this is |
|
103 |
not specified, the environment variable |
|
104 |
<envar>PGDATABASE</envar> is used. If that is not set, the |
|
105 |
user name specified for the connection is used. |
|
106 |
</para>
|
|
107 |
</listitem>
|
|
108 |
</varlistentry>
|
|
109 |
||
110 |
<varlistentry>
|
|
111 |
<term><option>-a</></term> |
|
112 |
<term><option>--data-only</></term> |
|
113 |
<listitem>
|
|
114 |
<para>
|
|
115 |
Dump only the data, not the schema (data definitions). |
|
116 |
</para>
|
|
117 |
||
118 |
<para>
|
|
119 |
This option is only meaningful for the plain-text format. For |
|
120 |
the archive formats, you can specify the option when you |
|
121 |
call <command>pg_restore</command>. |
|
122 |
</para>
|
|
123 |
</listitem>
|
|
124 |
</varlistentry>
|
|
125 |
||
126 |
<varlistentry>
|
|
127 |
<term><option>-b</></term> |
|
128 |
<term><option>--blobs</></term> |
|
129 |
<listitem>
|
|
130 |
<para>
|
|
131 |
Include large objects in the dump. This is the default behavior |
|
132 |
except when <option>--schema</>, <option>--table</>, or |
|
133 |
<option>--schema-only</> is specified, so the <option>-b</> |
|
134 |
switch is only useful to add large objects to selective dumps. |
|
135 |
</para>
|
|
136 |
</listitem>
|
|
137 |
</varlistentry>
|
|
138 |
||
139 |
<varlistentry>
|
|
140 |
<term><option>-c</option></term> |
|
141 |
<term><option>--clean</option></term> |
|
142 |
<listitem>
|
|
143 |
<para>
|
|
144 |
Output commands to clean (drop) |
|
1.1.1
by Martin Pitt
Import upstream version 9.1~beta2 |
145 |
database objects prior to outputting the commands for creating them. |
1
by Martin Pitt
Import upstream version 9.1~beta1 |
146 |
(Restore might generate some harmless errors.) |
147 |
</para>
|
|
148 |
||
149 |
<para>
|
|
150 |
This option is only meaningful for the plain-text format. For |
|
151 |
the archive formats, you can specify the option when you |
|
152 |
call <command>pg_restore</command>. |
|
153 |
</para>
|
|
154 |
</listitem>
|
|
155 |
</varlistentry>
|
|
156 |
||
157 |
<varlistentry>
|
|
158 |
<term><option>-C</></term> |
|
159 |
<term><option>--create</></term> |
|
160 |
<listitem>
|
|
161 |
<para>
|
|
162 |
Begin the output with a command to create the |
|
163 |
database itself and reconnect to the created database. (With a |
|
164 |
script of this form, it doesn't matter which database you connect |
|
165 |
to before running the script.) |
|
166 |
</para>
|
|
167 |
||
168 |
<para>
|
|
169 |
This option is only meaningful for the plain-text format. For |
|
170 |
the archive formats, you can specify the option when you |
|
171 |
call <command>pg_restore</command>. |
|
172 |
</para>
|
|
173 |
</listitem>
|
|
174 |
</varlistentry>
|
|
175 |
||
176 |
<varlistentry>
|
|
177 |
<term><option>-E <replaceable class="parameter">encoding</replaceable></option></term> |
|
178 |
<term><option>--encoding=<replaceable class="parameter">encoding</replaceable></option></term> |
|
179 |
<listitem>
|
|
180 |
<para>
|
|
181 |
Create the dump in the specified character set encoding. By default, |
|
182 |
the dump is created in the database encoding. (Another way to get the |
|
183 |
same result is to set the <envar>PGCLIENTENCODING</envar> environment |
|
184 |
variable to the desired dump encoding.) |
|
185 |
</para>
|
|
186 |
</listitem>
|
|
187 |
</varlistentry>
|
|
188 |
||
189 |
<varlistentry>
|
|
190 |
<term><option>-f <replaceable class="parameter">file</replaceable></option></term> |
|
191 |
<term><option>--file=<replaceable class="parameter">file</replaceable></option></term> |
|
192 |
<listitem>
|
|
193 |
<para>
|
|
194 |
Send output to the specified file. This parameter can be omitted for |
|
195 |
file based output formats, in which case the standard output is used. |
|
196 |
It must be given for the directory output format however, where it |
|
197 |
specifies the target directory instead of a file. In this case the |
|
198 |
directory is created by <command>pg_dump</command> and must not exist |
|
199 |
before. |
|
200 |
</para>
|
|
201 |
</listitem>
|
|
202 |
</varlistentry>
|
|
203 |
||
204 |
<varlistentry>
|
|
205 |
<term><option>-F <replaceable class="parameter">format</replaceable></option></term> |
|
206 |
<term><option>--format=<replaceable class="parameter">format</replaceable></option></term> |
|
207 |
<listitem>
|
|
208 |
<para>
|
|
209 |
Selects the format of the output. |
|
210 |
<replaceable>format</replaceable> can be one of the following: |
|
211 |
||
212 |
<variablelist>
|
|
213 |
<varlistentry>
|
|
214 |
<term><literal>p</></term> |
|
215 |
<term><literal>plain</></term> |
|
216 |
<listitem>
|
|
217 |
<para>
|
|
218 |
Output a plain-text <acronym>SQL</acronym> script file (the default). |
|
219 |
</para>
|
|
220 |
</listitem>
|
|
221 |
</varlistentry>
|
|
222 |
||
223 |
<varlistentry>
|
|
224 |
<term><literal>c</></term> |
|
225 |
<term><literal>custom</></term> |
|
226 |
<listitem>
|
|
227 |
<para>
|
|
228 |
Output a custom-format archive suitable for input into |
|
229 |
<application>pg_restore</application>. |
|
230 |
Together with the directory output format, this is the most flexible |
|
231 |
output format in that it allows manual selection and reordering of |
|
232 |
archived items during restore. This format is also compressed by |
|
233 |
default. |
|
234 |
</para>
|
|
235 |
</listitem>
|
|
236 |
</varlistentry>
|
|
237 |
||
238 |
<varlistentry>
|
|
239 |
<term><literal>d</></term> |
|
240 |
<term><literal>directory</></term> |
|
241 |
<listitem>
|
|
242 |
<para>
|
|
243 |
Output a directory-format archive suitable for input into |
|
244 |
<application>pg_restore</application>. This will create a directory |
|
245 |
with one file for each table and blob being dumped, plus a |
|
246 |
so-called Table of Contents file describing the dumped objects in a |
|
247 |
machine-readable format that <application>pg_restore</application> |
|
248 |
can read. A directory format archive can be manipulated with |
|
249 |
standard Unix tools; for example, files in an uncompressed archive |
|
250 |
can be compressed with the <application>gzip</application> tool. |
|
251 |
This format is compressed by default. |
|
252 |
</para>
|
|
253 |
</listitem>
|
|
254 |
</varlistentry>
|
|
255 |
||
256 |
<varlistentry>
|
|
257 |
<term><literal>t</></term> |
|
258 |
<term><literal>tar</></term> |
|
259 |
<listitem>
|
|
260 |
<para>
|
|
261 |
Output a <command>tar</command>-format archive suitable for input |
|
262 |
into <application>pg_restore</application>. The tar-format is |
|
263 |
compatible with the directory-format; extracting a tar-format |
|
264 |
archive produces a valid directory-format archive. |
|
265 |
However, the tar-format does not support compression and has a |
|
266 |
limit of 8 GB on the size of individual tables. Also, the relative |
|
267 |
order of table data items cannot be changed during restore. |
|
268 |
</para>
|
|
269 |
</listitem>
|
|
270 |
</varlistentry>
|
|
1.1.3
by Martin Pitt
Import upstream version 9.1~rc1 |
271 |
</variablelist></para>
|
1
by Martin Pitt
Import upstream version 9.1~beta1 |
272 |
</listitem>
|
273 |
</varlistentry>
|
|
274 |
||
275 |
<varlistentry>
|
|
276 |
<term><option>-i</></term> |
|
277 |
<term><option>--ignore-version</></term> |
|
278 |
<listitem>
|
|
279 |
<para>
|
|
280 |
A deprecated option that is now ignored. |
|
281 |
</para>
|
|
282 |
</listitem>
|
|
283 |
</varlistentry>
|
|
284 |
||
285 |
<varlistentry>
|
|
286 |
<term><option>-n <replaceable class="parameter">schema</replaceable></option></term> |
|
287 |
<term><option>--schema=<replaceable class="parameter">schema</replaceable></option></term> |
|
288 |
<listitem>
|
|
289 |
<para>
|
|
290 |
Dump only schemas matching <replaceable
|
|
291 |
class="parameter">schema</replaceable>; this selects both the |
|
292 |
schema itself, and all its contained objects. When this option is |
|
293 |
not specified, all non-system schemas in the target database will be |
|
294 |
dumped. Multiple schemas can be |
|
295 |
selected by writing multiple <option>-n</> switches. Also, the |
|
296 |
<replaceable class="parameter">schema</replaceable> parameter is |
|
297 |
interpreted as a pattern according to the same rules used by |
|
298 |
<application>psql</>'s <literal>\d</> commands (see <xref |
|
299 |
linkend="APP-PSQL-patterns" endterm="APP-PSQL-patterns-title">), |
|
300 |
so multiple schemas can also be selected by writing wildcard characters |
|
301 |
in the pattern. When using wildcards, be careful to quote the pattern |
|
302 |
if needed to prevent the shell from expanding the wildcards; see |
|
303 |
<xref linkend="pg-dump-examples" endterm="pg-dump-examples-title">. |
|
304 |
</para>
|
|
305 |
||
306 |
<note>
|
|
307 |
<para>
|
|
308 |
When <option>-n</> is specified, <application>pg_dump</application> |
|
309 |
makes no attempt to dump any other database objects that the selected |
|
310 |
schema(s) might depend upon. Therefore, there is no guarantee |
|
311 |
that the results of a specific-schema dump can be successfully |
|
312 |
restored by themselves into a clean database. |
|
313 |
</para>
|
|
314 |
</note>
|
|
315 |
||
316 |
<note>
|
|
317 |
<para>
|
|
318 |
Non-schema objects such as blobs are not dumped when <option>-n</> is |
|
319 |
specified. You can add blobs back to the dump with the |
|
320 |
<option>--blobs</> switch. |
|
321 |
</para>
|
|
322 |
</note>
|
|
323 |
||
324 |
</listitem>
|
|
325 |
</varlistentry>
|
|
326 |
||
327 |
<varlistentry>
|
|
328 |
<term><option>-N <replaceable class="parameter">schema</replaceable></option></term> |
|
329 |
<term><option>--exclude-schema=<replaceable class="parameter">schema</replaceable></option></term> |
|
330 |
<listitem>
|
|
331 |
<para>
|
|
332 |
Do not dump any schemas matching the <replaceable
|
|
333 |
class="parameter">schema</replaceable> pattern. The pattern is |
|
334 |
interpreted according to the same rules as for <option>-n</>. |
|
335 |
<option>-N</> can be given more than once to exclude schemas |
|
336 |
matching any of several patterns. |
|
337 |
</para>
|
|
338 |
||
339 |
<para>
|
|
340 |
When both <option>-n</> and <option>-N</> are given, the behavior |
|
341 |
is to dump just the schemas that match at least one <option>-n</> |
|
342 |
switch but no <option>-N</> switches. If <option>-N</> appears |
|
343 |
without <option>-n</>, then schemas matching <option>-N</> are |
|
344 |
excluded from what is otherwise a normal dump. |
|
345 |
</para>
|
|
346 |
</listitem>
|
|
347 |
</varlistentry>
|
|
348 |
||
349 |
<varlistentry>
|
|
350 |
<term><option>-o</></term> |
|
351 |
<term><option>--oids</></term> |
|
352 |
<listitem>
|
|
353 |
<para>
|
|
354 |
Dump object identifiers (<acronym>OID</acronym>s) as part of the |
|
355 |
data for every table. Use this option if your application references |
|
356 |
the <acronym>OID</> |
|
357 |
columns in some way (e.g., in a foreign key constraint). |
|
358 |
Otherwise, this option should not be used. |
|
359 |
</para>
|
|
360 |
</listitem>
|
|
361 |
</varlistentry>
|
|
362 |
||
363 |
<varlistentry>
|
|
364 |
<term><option>-O</></term> |
|
365 |
<term><option>--no-owner</option></term> |
|
366 |
<listitem>
|
|
367 |
<para>
|
|
368 |
Do not output commands to set |
|
369 |
ownership of objects to match the original database. |
|
370 |
By default, <application>pg_dump</application> issues |
|
371 |
<command>ALTER OWNER</> or |
|
372 |
<command>SET SESSION AUTHORIZATION</command> |
|
373 |
statements to set ownership of created database objects. |
|
374 |
These statements |
|
375 |
will fail when the script is run unless it is started by a superuser |
|
376 |
(or the same user that owns all of the objects in the script). |
|
377 |
To make a script that can be restored by any user, but will give |
|
378 |
that user ownership of all the objects, specify <option>-O</>. |
|
379 |
</para>
|
|
380 |
||
381 |
<para>
|
|
382 |
This option is only meaningful for the plain-text format. For |
|
383 |
the archive formats, you can specify the option when you |
|
384 |
call <command>pg_restore</command>. |
|
385 |
</para>
|
|
386 |
</listitem>
|
|
387 |
</varlistentry>
|
|
388 |
||
389 |
<varlistentry>
|
|
390 |
<term><option>-R</option></term> |
|
391 |
<term><option>--no-reconnect</option></term> |
|
392 |
<listitem>
|
|
393 |
<para>
|
|
394 |
This option is obsolete but still accepted for backwards |
|
395 |
compatibility. |
|
396 |
</para>
|
|
397 |
</listitem>
|
|
398 |
</varlistentry>
|
|
399 |
||
400 |
<varlistentry>
|
|
401 |
<term><option>-s</option></term> |
|
402 |
<term><option>--schema-only</option></term> |
|
403 |
<listitem>
|
|
404 |
<para>
|
|
405 |
Dump only the object definitions (schema), not data. |
|
406 |
</para>
|
|
407 |
</listitem>
|
|
408 |
</varlistentry>
|
|
409 |
||
410 |
<varlistentry>
|
|
411 |
<term><option>-S <replaceable class="parameter">username</replaceable></option></term> |
|
412 |
<term><option>--superuser=<replaceable class="parameter">username</replaceable></option></term> |
|
413 |
<listitem>
|
|
414 |
<para>
|
|
415 |
Specify the superuser user name to use when disabling triggers. |
|
416 |
This is only relevant if <option>--disable-triggers</> is used. |
|
417 |
(Usually, it's better to leave this out, and instead start the |
|
418 |
resulting script as superuser.) |
|
419 |
</para>
|
|
420 |
</listitem>
|
|
421 |
</varlistentry>
|
|
422 |
||
423 |
<varlistentry>
|
|
424 |
<term><option>-t <replaceable class="parameter">table</replaceable></option></term> |
|
425 |
<term><option>--table=<replaceable class="parameter">table</replaceable></option></term> |
|
426 |
<listitem>
|
|
427 |
<para>
|
|
428 |
Dump only tables (or views or sequences or foreign tables) matching |
|
429 |
<replaceable class="parameter">table</replaceable>. Multiple tables |
|
430 |
can be selected by writing multiple <option>-t</> switches. Also, the |
|
431 |
<replaceable class="parameter">table</replaceable> parameter is |
|
432 |
interpreted as a pattern according to the same rules used by |
|
433 |
<application>psql</>'s <literal>\d</> commands (see <xref |
|
434 |
linkend="APP-PSQL-patterns" endterm="APP-PSQL-patterns-title">), |
|
435 |
so multiple tables can also be selected by writing wildcard characters |
|
436 |
in the pattern. When using wildcards, be careful to quote the pattern |
|
437 |
if needed to prevent the shell from expanding the wildcards; see |
|
438 |
<xref linkend="pg-dump-examples" endterm="pg-dump-examples-title">. |
|
439 |
</para>
|
|
440 |
||
441 |
<para>
|
|
442 |
The <option>-n</> and <option>-N</> switches have no effect when |
|
443 |
<option>-t</> is used, because tables selected by <option>-t</> will |
|
444 |
be dumped regardless of those switches, and non-table objects will not |
|
445 |
be dumped. |
|
446 |
</para>
|
|
447 |
||
448 |
<note>
|
|
449 |
<para>
|
|
450 |
When <option>-t</> is specified, <application>pg_dump</application> |
|
451 |
makes no attempt to dump any other database objects that the selected |
|
452 |
table(s) might depend upon. Therefore, there is no guarantee |
|
453 |
that the results of a specific-table dump can be successfully |
|
454 |
restored by themselves into a clean database. |
|
455 |
</para>
|
|
456 |
</note>
|
|
457 |
||
458 |
<note>
|
|
459 |
<para>
|
|
460 |
The behavior of the <option>-t</> switch is not entirely upward |
|
461 |
compatible with pre-8.2 <productname>PostgreSQL</productname> |
|
462 |
versions. Formerly, writing <literal>-t tab</> would dump all |
|
463 |
tables named <literal>tab</>, but now it just dumps whichever one |
|
464 |
is visible in your default search path. To get the old behavior |
|
465 |
you can write <literal>-t '*.tab'</>. Also, you must write something |
|
466 |
like <literal>-t sch.tab</> to select a table in a particular schema, |
|
467 |
rather than the old locution of <literal>-n sch -t tab</>. |
|
468 |
</para>
|
|
469 |
</note>
|
|
470 |
</listitem>
|
|
471 |
</varlistentry>
|
|
472 |
||
473 |
<varlistentry>
|
|
474 |
<term><option>-T <replaceable class="parameter">table</replaceable></option></term> |
|
475 |
<term><option>--exclude-table=<replaceable class="parameter">table</replaceable></option></term> |
|
476 |
<listitem>
|
|
477 |
<para>
|
|
478 |
Do not dump any tables matching the <replaceable
|
|
479 |
class="parameter">table</replaceable> pattern. The pattern is |
|
480 |
interpreted according to the same rules as for <option>-t</>. |
|
481 |
<option>-T</> can be given more than once to exclude tables |
|
482 |
matching any of several patterns. |
|
483 |
</para>
|
|
484 |
||
485 |
<para>
|
|
486 |
When both <option>-t</> and <option>-T</> are given, the behavior |
|
487 |
is to dump just the tables that match at least one <option>-t</> |
|
488 |
switch but no <option>-T</> switches. If <option>-T</> appears |
|
489 |
without <option>-t</>, then tables matching <option>-T</> are |
|
490 |
excluded from what is otherwise a normal dump. |
|
491 |
</para>
|
|
492 |
</listitem>
|
|
493 |
</varlistentry>
|
|
494 |
||
495 |
<varlistentry>
|
|
496 |
<term><option>-v</></term> |
|
497 |
<term><option>--verbose</></term> |
|
498 |
<listitem>
|
|
499 |
<para>
|
|
500 |
Specifies verbose mode. This will cause |
|
501 |
<application>pg_dump</application> to output detailed object |
|
502 |
comments and start/stop times to the dump file, and progress |
|
503 |
messages to standard error. |
|
504 |
</para>
|
|
505 |
</listitem>
|
|
506 |
</varlistentry>
|
|
507 |
||
508 |
<varlistentry>
|
|
509 |
<term><option>-V</></term> |
|
510 |
<term><option>--version</></term> |
|
511 |
<listitem>
|
|
512 |
<para>
|
|
513 |
Print the <application>pg_dump</application> version and exit. |
|
514 |
</para>
|
|
515 |
</listitem>
|
|
516 |
</varlistentry>
|
|
517 |
||
518 |
<varlistentry>
|
|
519 |
<term><option>-x</></term> |
|
520 |
<term><option>--no-privileges</></term> |
|
521 |
<term><option>--no-acl</></term> |
|
522 |
<listitem>
|
|
523 |
<para>
|
|
524 |
Prevent dumping of access privileges (grant/revoke commands). |
|
525 |
</para>
|
|
526 |
</listitem>
|
|
527 |
</varlistentry>
|
|
528 |
||
529 |
<varlistentry>
|
|
530 |
<term><option>-Z <replaceable class="parameter">0..9</replaceable></option></term> |
|
531 |
<term><option>--compress=<replaceable class="parameter">0..9</replaceable></option></term> |
|
532 |
<listitem>
|
|
533 |
<para>
|
|
534 |
Specify the compression level to use. Zero means no compression. |
|
535 |
For the custom archive format, this specifies compression of |
|
536 |
individual table-data segments, and the default is to compress |
|
537 |
at a moderate level. |
|
538 |
For plain text output, setting a nonzero compression level causes |
|
539 |
the entire output file to be compressed, as though it had been |
|
540 |
fed through <application>gzip</>; but the default is not to compress. |
|
541 |
The tar archive format currently does not support compression at all. |
|
542 |
</para>
|
|
543 |
</listitem>
|
|
544 |
</varlistentry>
|
|
545 |
||
546 |
<varlistentry>
|
|
547 |
<term><option>--binary-upgrade</option></term> |
|
548 |
<listitem>
|
|
549 |
<para>
|
|
550 |
This option is for use by in-place upgrade utilities. Its use |
|
551 |
for other purposes is not recommended or supported. The |
|
552 |
behavior of the option may change in future releases without |
|
553 |
notice. |
|
554 |
</para>
|
|
555 |
</listitem>
|
|
556 |
</varlistentry>
|
|
557 |
||
558 |
<varlistentry>
|
|
559 |
<term><option>--column-inserts</option></term> |
|
560 |
<term><option>--attribute-inserts</option></term> |
|
561 |
<listitem>
|
|
562 |
<para>
|
|
563 |
Dump data as <command>INSERT</command> commands with explicit |
|
564 |
column names (<literal>INSERT INTO
|
|
565 |
<replaceable>table</replaceable> |
|
566 |
(<replaceable>column</replaceable>, ...) VALUES |
|
567 |
...</literal>). This will make restoration very slow; it is mainly
|
|
568 |
useful for making dumps that can be loaded into |
|
569 |
non-<productname>PostgreSQL</productname> databases. |
|
570 |
However, since this option generates a separate command for each row, |
|
571 |
an error in reloading a row causes only that row to be lost rather |
|
572 |
than the entire table contents. |
|
573 |
</para>
|
|
574 |
</listitem>
|
|
575 |
</varlistentry>
|
|
576 |
||
577 |
<varlistentry>
|
|
578 |
<term><option>--disable-dollar-quoting</></term> |
|
579 |
<listitem>
|
|
580 |
<para>
|
|
581 |
This option disables the use of dollar quoting for function bodies, |
|
582 |
and forces them to be quoted using SQL standard string syntax. |
|
583 |
</para>
|
|
584 |
</listitem>
|
|
585 |
</varlistentry>
|
|
586 |
||
587 |
<varlistentry>
|
|
588 |
<term><option>--disable-triggers</></term> |
|
589 |
<listitem>
|
|
590 |
<para>
|
|
591 |
This option is only relevant when creating a data-only dump. |
|
592 |
It instructs <application>pg_dump</application> to include commands |
|
593 |
to temporarily disable triggers on the target tables while |
|
594 |
the data is reloaded. Use this if you have referential |
|
595 |
integrity checks or other triggers on the tables that you |
|
596 |
do not want to invoke during data reload. |
|
597 |
</para>
|
|
598 |
||
599 |
<para>
|
|
600 |
Presently, the commands emitted for <option>--disable-triggers</> |
|
601 |
must be done as superuser. So, you should also specify |
|
602 |
a superuser name with <option>-S</>, or preferably be careful to |
|
603 |
start the resulting script as a superuser. |
|
604 |
</para>
|
|
605 |
||
606 |
<para>
|
|
607 |
This option is only meaningful for the plain-text format. For |
|
608 |
the archive formats, you can specify the option when you |
|
609 |
call <command>pg_restore</command>. |
|
610 |
</para>
|
|
611 |
</listitem>
|
|
612 |
</varlistentry>
|
|
613 |
||
614 |
<varlistentry>
|
|
1.1.1
by Martin Pitt
Import upstream version 9.1~beta2 |
615 |
<term><option>--inserts</option></term> |
616 |
<listitem>
|
|
617 |
<para>
|
|
618 |
Dump data as <command>INSERT</command> commands (rather |
|
619 |
than <command>COPY</command>). This will make restoration very slow; |
|
620 |
it is mainly useful for making dumps that can be loaded into |
|
621 |
non-<productname>PostgreSQL</productname> databases. |
|
622 |
However, since this option generates a separate command for each row, |
|
623 |
an error in reloading a row causes only that row to be lost rather |
|
624 |
than the entire table contents. |
|
625 |
Note that |
|
626 |
the restore might fail altogether if you have rearranged column order. |
|
627 |
The <option>--column-inserts</option> option is safe against column |
|
628 |
order changes, though even slower. |
|
629 |
</para>
|
|
630 |
</listitem>
|
|
631 |
</varlistentry>
|
|
632 |
||
633 |
<varlistentry>
|
|
1
by Martin Pitt
Import upstream version 9.1~beta1 |
634 |
<term><option>--lock-wait-timeout=<replaceable class="parameter">timeout</replaceable></option></term> |
635 |
<listitem>
|
|
636 |
<para>
|
|
637 |
Do not wait forever to acquire shared table locks at the beginning of |
|
638 |
the dump. Instead fail if unable to lock a table within the specified |
|
639 |
<replaceable class="parameter">timeout</>. The timeout may be |
|
640 |
specified in any of the formats accepted by <command>SET
|
|
641 |
statement_timeout</>. (Allowed values vary depending on the server
|
|
642 |
version you are dumping from, but an integer number of milliseconds |
|
643 |
is accepted by all versions since 7.3. This option is ignored when |
|
644 |
dumping from a pre-7.3 server.) |
|
645 |
</para>
|
|
646 |
</listitem>
|
|
647 |
</varlistentry>
|
|
648 |
||
649 |
<varlistentry>
|
|
1.1.1
by Martin Pitt
Import upstream version 9.1~beta2 |
650 |
<term><option>--no-security-labels</option></term> |
651 |
<listitem>
|
|
652 |
<para>
|
|
653 |
Do not dump security labels. |
|
654 |
</para>
|
|
655 |
</listitem>
|
|
656 |
</varlistentry>
|
|
657 |
||
658 |
<varlistentry>
|
|
659 |
<term><option>--no-tablespaces</option></term> |
|
660 |
<listitem>
|
|
661 |
<para>
|
|
662 |
Do not output commands to select tablespaces. |
|
663 |
With this option, all objects will be created in whichever |
|
664 |
tablespace is the default during restore. |
|
665 |
</para>
|
|
666 |
||
667 |
<para>
|
|
668 |
This option is only meaningful for the plain-text format. For |
|
669 |
the archive formats, you can specify the option when you |
|
670 |
call <command>pg_restore</command>. |
|
671 |
</para>
|
|
672 |
</listitem>
|
|
673 |
</varlistentry>
|
|
674 |
||
675 |
<varlistentry>
|
|
676 |
<term><option>--no-unlogged-table-data</option></term> |
|
677 |
<listitem>
|
|
678 |
<para>
|
|
679 |
Do not dump the contents of unlogged tables. This option has no |
|
680 |
effect on whether or not the table definitions (schema) are dumped; |
|
1.1.10
by Martin Pitt
Import upstream version 9.1.8 |
681 |
it only suppresses dumping the table data. Data in unlogged tables |
682 |
is always excluded when dumping from a standby server. |
|
1.1.1
by Martin Pitt
Import upstream version 9.1~beta2 |
683 |
</para>
|
684 |
</listitem>
|
|
685 |
</varlistentry>
|
|
686 |
||
687 |
<varlistentry>
|
|
688 |
<term><option>--quote-all-identifiers</></term> |
|
689 |
<listitem>
|
|
690 |
<para>
|
|
691 |
Force quoting of all identifiers. This may be useful when dumping a |
|
692 |
database for migration to a future version that may have introduced |
|
693 |
additional keywords. |
|
694 |
</para>
|
|
695 |
</listitem>
|
|
696 |
</varlistentry>
|
|
697 |
||
698 |
<varlistentry>
|
|
1
by Martin Pitt
Import upstream version 9.1~beta1 |
699 |
<term><option>--serializable-deferrable</option></term> |
700 |
<listitem>
|
|
701 |
<para>
|
|
702 |
Use a <literal>serializable</literal> transaction for the dump, to |
|
703 |
ensure that the snapshot used is consistent with later database |
|
704 |
states; but do this by waiting for a point in the transaction stream |
|
705 |
at which no anomalies can be present, so that there isn't a risk of |
|
706 |
the dump failing or causing other transactions to roll back with a |
|
707 |
<literal>serialization_failure</literal>. See <xref linkend="mvcc"> |
|
708 |
for more information about transaction isolation and concurrency |
|
709 |
control. |
|
710 |
</para>
|
|
711 |
||
712 |
<para>
|
|
713 |
This option is not beneficial for a dump which is intended only for |
|
714 |
disaster recovery. It could be useful for a dump used to load a |
|
715 |
copy of the database for reporting or other read-only load sharing |
|
716 |
while the original database continues to be updated. Without it the |
|
717 |
dump may reflect a state which is not consistent with any serial |
|
718 |
execution of the transactions eventually committed. For example, if |
|
719 |
batch processing techniques are used, a batch may show as closed in |
|
720 |
the dump without all of the items which are in the batch appearing. |
|
721 |
</para>
|
|
722 |
||
723 |
<para>
|
|
724 |
This option will make no difference if there are no read-write |
|
725 |
transactions active when pg_dump is started. If read-write |
|
726 |
transactions are active, the start of the dump may be delayed for an |
|
727 |
indeterminate length of time. Once running, performance with or |
|
728 |
without the switch is the same. |
|
729 |
</para>
|
|
730 |
</listitem>
|
|
731 |
</varlistentry>
|
|
732 |
||
733 |
<varlistentry>
|
|
734 |
<term><option>--use-set-session-authorization</></term> |
|
735 |
<listitem>
|
|
736 |
<para>
|
|
737 |
Output SQL-standard <command>SET SESSION AUTHORIZATION</> commands |
|
738 |
instead of <command>ALTER OWNER</> commands to determine object |
|
739 |
ownership. This makes the dump more standards-compatible, but |
|
740 |
depending on the history of the objects in the dump, might not restore |
|
741 |
properly. Also, a dump using <command>SET SESSION AUTHORIZATION</> |
|
742 |
will certainly require superuser privileges to restore correctly, |
|
743 |
whereas <command>ALTER OWNER</> requires lesser privileges. |
|
744 |
</para>
|
|
745 |
</listitem>
|
|
746 |
</varlistentry>
|
|
747 |
||
748 |
<varlistentry>
|
|
749 |
<term><option>-?</></term> |
|
750 |
<term><option>--help</></term> |
|
751 |
<listitem>
|
|
752 |
<para>
|
|
753 |
Show help about <application>pg_dump</application> command line |
|
754 |
arguments, and exit. |
|
755 |
</para>
|
|
756 |
</listitem>
|
|
757 |
</varlistentry>
|
|
758 |
||
759 |
</variablelist>
|
|
760 |
</para>
|
|
761 |
||
762 |
<para>
|
|
763 |
The following command-line options control the database connection parameters. |
|
764 |
||
765 |
<variablelist>
|
|
766 |
<varlistentry>
|
|
767 |
<term><option>-h <replaceable class="parameter">host</replaceable></option></term> |
|
768 |
<term><option>--host=<replaceable class="parameter">host</replaceable></option></term> |
|
769 |
<listitem>
|
|
770 |
<para>
|
|
771 |
Specifies the host name of the machine on which the server is |
|
772 |
running. If the value begins with a slash, it is used as the |
|
773 |
directory for the Unix domain socket. The default is taken |
|
774 |
from the <envar>PGHOST</envar> environment variable, if set, |
|
775 |
else a Unix domain socket connection is attempted. |
|
776 |
</para>
|
|
777 |
</listitem>
|
|
778 |
</varlistentry>
|
|
779 |
||
780 |
<varlistentry>
|
|
781 |
<term><option>-p <replaceable class="parameter">port</replaceable></option></term> |
|
782 |
<term><option>--port=<replaceable class="parameter">port</replaceable></option></term> |
|
783 |
<listitem>
|
|
784 |
<para>
|
|
785 |
Specifies the TCP port or local Unix domain socket file |
|
786 |
extension on which the server is listening for connections. |
|
787 |
Defaults to the <envar>PGPORT</envar> environment variable, if |
|
788 |
set, or a compiled-in default. |
|
789 |
</para>
|
|
790 |
</listitem>
|
|
791 |
</varlistentry>
|
|
792 |
||
793 |
<varlistentry>
|
|
794 |
<term><option>-U <replaceable>username</replaceable></option></term> |
|
795 |
<term><option>--username=<replaceable class="parameter">username</replaceable></option></term> |
|
796 |
<listitem>
|
|
797 |
<para>
|
|
798 |
User name to connect as. |
|
799 |
</para>
|
|
800 |
</listitem>
|
|
801 |
</varlistentry>
|
|
802 |
||
803 |
<varlistentry>
|
|
804 |
<term><option>-w</></term> |
|
805 |
<term><option>--no-password</></term> |
|
806 |
<listitem>
|
|
807 |
<para>
|
|
808 |
Never issue a password prompt. If the server requires |
|
809 |
password authentication and a password is not available by |
|
810 |
other means such as a <filename>.pgpass</filename> file, the |
|
811 |
connection attempt will fail. This option can be useful in |
|
812 |
batch jobs and scripts where no user is present to enter a |
|
813 |
password. |
|
814 |
</para>
|
|
815 |
</listitem>
|
|
816 |
</varlistentry>
|
|
817 |
||
818 |
<varlistentry>
|
|
819 |
<term><option>-W</option></term> |
|
820 |
<term><option>--password</option></term> |
|
821 |
<listitem>
|
|
822 |
<para>
|
|
823 |
Force <application>pg_dump</application> to prompt for a |
|
824 |
password before connecting to a database. |
|
825 |
</para>
|
|
826 |
||
827 |
<para>
|
|
828 |
This option is never essential, since |
|
829 |
<application>pg_dump</application> will automatically prompt |
|
830 |
for a password if the server demands password authentication. |
|
831 |
However, <application>pg_dump</application> will waste a |
|
832 |
connection attempt finding out that the server wants a password. |
|
833 |
In some cases it is worth typing <option>-W</> to avoid the extra |
|
834 |
connection attempt. |
|
835 |
</para>
|
|
836 |
</listitem>
|
|
837 |
</varlistentry>
|
|
838 |
||
839 |
<varlistentry>
|
|
840 |
<term><option>--role=<replaceable class="parameter">rolename</replaceable></option></term> |
|
841 |
<listitem>
|
|
842 |
<para>
|
|
843 |
Specifies a role name to be used to create the dump. |
|
844 |
This option causes <application>pg_dump</> to issue a |
|
845 |
<command>SET ROLE</> <replaceable class="parameter">rolename</> |
|
846 |
command after connecting to the database. It is useful when the |
|
847 |
authenticated user (specified by <option>-U</>) lacks privileges |
|
848 |
needed by <application>pg_dump</>, but can switch to a role with |
|
849 |
the required rights. Some installations have a policy against |
|
850 |
logging in directly as a superuser, and use of this option allows |
|
851 |
dumps to be made without violating the policy. |
|
852 |
</para>
|
|
853 |
</listitem>
|
|
854 |
</varlistentry>
|
|
855 |
</variablelist>
|
|
856 |
</para>
|
|
857 |
</refsect1>
|
|
858 |
||
859 |
<refsect1>
|
|
860 |
<title>Environment</title> |
|
861 |
||
862 |
<variablelist>
|
|
863 |
<varlistentry>
|
|
864 |
<term><envar>PGDATABASE</envar></term> |
|
865 |
<term><envar>PGHOST</envar></term> |
|
866 |
<term><envar>PGOPTIONS</envar></term> |
|
867 |
<term><envar>PGPORT</envar></term> |
|
868 |
||
869 |
<term><envar>PGUSER</envar></term> |
|
870 |
<listitem>
|
|
871 |
<para>
|
|
872 |
Default connection parameters. |
|
873 |
</para>
|
|
874 |
</listitem>
|
|
875 |
||
876 |
</varlistentry>
|
|
877 |
</variablelist>
|
|
878 |
||
879 |
<para>
|
|
880 |
This utility, like most other <productname>PostgreSQL</> utilities, |
|
881 |
also uses the environment variables supported by <application>libpq</> |
|
882 |
(see <xref linkend="libpq-envars">). |
|
883 |
</para>
|
|
884 |
||
885 |
</refsect1>
|
|
886 |
||
887 |
<refsect1 id="app-pgdump-diagnostics"> |
|
888 |
<title>Diagnostics</title> |
|
889 |
||
890 |
<para>
|
|
891 |
<application>pg_dump</application> internally executes |
|
892 |
<command>SELECT</command> statements. If you have problems running |
|
893 |
<application>pg_dump</application>, make sure you are able to |
|
894 |
select information from the database using, for example, <xref
|
|
895 |
linkend="app-psql">. Also, any default connection settings and environment |
|
896 |
variables used by the <application>libpq</application> front-end |
|
897 |
library will apply. |
|
898 |
</para>
|
|
899 |
||
900 |
<para>
|
|
901 |
The database activity of <application>pg_dump</application> is |
|
902 |
normally collected by the statistics collector. If this is |
|
903 |
undesirable, you can set parameter <varname>track_counts</> |
|
904 |
to false via <envar>PGOPTIONS</envar> or the <literal>ALTER |
|
905 |
USER</literal> command.
|
|
906 |
</para>
|
|
907 |
||
908 |
</refsect1>
|
|
909 |
||
910 |
||
911 |
<refsect1 id="pg-dump-notes"> |
|
912 |
<title>Notes</title> |
|
913 |
||
914 |
<para>
|
|
915 |
If your database cluster has any local additions to the <literal>template1</> database, |
|
916 |
be careful to restore the output of <application>pg_dump</application> into a |
|
917 |
truly empty database; otherwise you are likely to get errors due to |
|
918 |
duplicate definitions of the added objects. To make an empty database |
|
919 |
without any local additions, copy from <literal>template0</> not <literal>template1</>, |
|
920 |
for example: |
|
921 |
<programlisting>
|
|
922 |
CREATE DATABASE foo WITH TEMPLATE template0; |
|
923 |
</programlisting>
|
|
924 |
</para>
|
|
925 |
||
926 |
<para>
|
|
927 |
When a data-only dump is chosen and the option <option>--disable-triggers</> |
|
928 |
is used, <application>pg_dump</application> emits commands |
|
929 |
to disable triggers on user tables before inserting the data, |
|
930 |
and then commands to re-enable them after the data has been |
|
931 |
inserted. If the restore is stopped in the middle, the system |
|
932 |
catalogs might be left in the wrong state. |
|
933 |
</para>
|
|
934 |
||
935 |
<para>
|
|
936 |
Members of tar archives are limited to a size less than 8 GB. |
|
937 |
(This is an inherent limitation of the tar file format.) Therefore |
|
938 |
this format cannot be used if the textual representation of any one table |
|
939 |
exceeds that size. The total size of a tar archive and any of the |
|
940 |
other output formats is not limited, except possibly by the |
|
941 |
operating system. |
|
942 |
</para>
|
|
943 |
||
944 |
<para>
|
|
945 |
The dump file produced by <application>pg_dump</application> |
|
946 |
does not contain the statistics used by the optimizer to make |
|
947 |
query planning decisions. Therefore, it is wise to run |
|
948 |
<command>ANALYZE</command> after restoring from a dump file |
|
949 |
to ensure optimal performance; see <xref linkend="vacuum-for-statistics"> |
|
950 |
and <xref linkend="autovacuum"> for more information. |
|
951 |
The dump file also does not |
|
952 |
contain any <command>ALTER DATABASE ... SET</> commands; |
|
953 |
these settings are dumped by <xref linkend="app-pg-dumpall">, |
|
954 |
along with database users and other installation-wide settings. |
|
955 |
</para>
|
|
956 |
||
957 |
<para>
|
|
958 |
Because <application>pg_dump</application> is used to transfer data |
|
959 |
to newer versions of <productname>PostgreSQL</>, the output of |
|
960 |
<application>pg_dump</application> can be expected to load into |
|
961 |
<productname>PostgreSQL</> server versions newer than |
|
962 |
<application>pg_dump</>'s version. <application>pg_dump</> can also |
|
963 |
dump from <productname>PostgreSQL</> servers older than its own version. |
|
964 |
(Currently, servers back to version 7.0 are supported.) |
|
965 |
However, <application>pg_dump</> cannot dump from |
|
966 |
<productname>PostgreSQL</> servers newer than its own major version; |
|
967 |
it will refuse to even try, rather than risk making an invalid dump. |
|
968 |
Also, it is not guaranteed that <application>pg_dump</>'s output can |
|
969 |
be loaded into a server of an older major version — not even if the
|
|
970 |
dump was taken from a server of that version. Loading a dump file |
|
971 |
into an older server may require manual editing of the dump file |
|
972 |
to remove syntax not understood by the older server. |
|
973 |
</para>
|
|
974 |
</refsect1>
|
|
975 |
||
976 |
<refsect1 id="pg-dump-examples"> |
|
977 |
<title id="pg-dump-examples-title">Examples</title> |
|
978 |
||
979 |
<para>
|
|
980 |
To dump a database called <literal>mydb</> into a SQL-script file: |
|
981 |
<screen>
|
|
982 |
<prompt>$</prompt> <userinput>pg_dump mydb > db.sql</userinput> |
|
983 |
</screen>
|
|
984 |
</para>
|
|
985 |
||
986 |
<para>
|
|
987 |
To reload such a script into a (freshly created) database named |
|
988 |
<literal>newdb</>: |
|
989 |
||
990 |
<screen>
|
|
991 |
<prompt>$</prompt> <userinput>psql -d newdb -f db.sql</userinput> |
|
992 |
</screen>
|
|
993 |
</para>
|
|
994 |
||
995 |
<para>
|
|
996 |
To dump a database into a custom-format archive file: |
|
997 |
||
998 |
<screen>
|
|
999 |
<prompt>$</prompt> <userinput>pg_dump -Fc mydb > db.dump</userinput> |
|
1000 |
</screen>
|
|
1001 |
</para>
|
|
1002 |
||
1003 |
<para>
|
|
1004 |
To dump a database into a directory-format archive: |
|
1005 |
||
1006 |
<screen>
|
|
1007 |
<prompt>$</prompt> <userinput>pg_dump -Fd mydb -f dumpdir</userinput> |
|
1008 |
</screen>
|
|
1009 |
</para>
|
|
1010 |
||
1011 |
<para>
|
|
1012 |
To reload an archive file into a (freshly created) database named |
|
1013 |
<literal>newdb</>: |
|
1014 |
||
1015 |
<screen>
|
|
1016 |
<prompt>$</prompt> <userinput>pg_restore -d newdb db.dump</userinput> |
|
1017 |
</screen>
|
|
1018 |
</para>
|
|
1019 |
||
1020 |
<para>
|
|
1021 |
To dump a single table named <literal>mytab</>: |
|
1022 |
||
1023 |
<screen>
|
|
1024 |
<prompt>$</prompt> <userinput>pg_dump -t mytab mydb > db.sql</userinput> |
|
1025 |
</screen>
|
|
1026 |
</para>
|
|
1027 |
||
1028 |
<para>
|
|
1029 |
To dump all tables whose names start with <literal>emp</> in the |
|
1030 |
<literal>detroit</> schema, except for the table named |
|
1031 |
<literal>employee_log</literal>: |
|
1032 |
||
1033 |
<screen>
|
|
1034 |
<prompt>$</prompt> <userinput>pg_dump -t 'detroit.emp*' -T detroit.employee_log mydb > db.sql</userinput> |
|
1035 |
</screen>
|
|
1036 |
</para>
|
|
1037 |
||
1038 |
<para>
|
|
1039 |
To dump all schemas whose names start with <literal>east</> or |
|
1040 |
<literal>west</> and end in <literal>gsm</>, excluding any schemas whose |
|
1041 |
names contain the word <literal>test</>: |
|
1042 |
||
1043 |
<screen>
|
|
1044 |
<prompt>$</prompt> <userinput>pg_dump -n 'east*gsm' -n 'west*gsm' -N '*test*' mydb > db.sql</userinput> |
|
1045 |
</screen>
|
|
1046 |
</para>
|
|
1047 |
||
1048 |
<para>
|
|
1049 |
The same, using regular expression notation to consolidate the switches: |
|
1050 |
||
1051 |
<screen>
|
|
1052 |
<prompt>$</prompt> <userinput>pg_dump -n '(east|west)*gsm' -N '*test*' mydb > db.sql</userinput> |
|
1053 |
</screen>
|
|
1054 |
</para>
|
|
1055 |
||
1056 |
<para>
|
|
1057 |
To dump all database objects except for tables whose names begin with |
|
1058 |
<literal>ts_</literal>: |
|
1059 |
||
1060 |
<screen>
|
|
1061 |
<prompt>$</prompt> <userinput>pg_dump -T 'ts_*' mydb > db.sql</userinput> |
|
1062 |
</screen>
|
|
1063 |
</para>
|
|
1064 |
||
1065 |
<para>
|
|
1066 |
To specify an upper-case or mixed-case name in <option>-t</> and related |
|
1067 |
switches, you need to double-quote the name; else it will be folded to |
|
1068 |
lower case (see <xref
|
|
1069 |
linkend="APP-PSQL-patterns" endterm="APP-PSQL-patterns-title">). But |
|
1070 |
double quotes are special to the shell, so in turn they must be quoted. |
|
1071 |
Thus, to dump a single table with a mixed-case name, you need something |
|
1072 |
like |
|
1073 |
||
1074 |
<screen>
|
|
1075 |
<prompt>$</prompt> <userinput>pg_dump -t '"MixedCaseName"' mydb > mytab.sql</userinput> |
|
1.1.3
by Martin Pitt
Import upstream version 9.1~rc1 |
1076 |
</screen></para>
|
1
by Martin Pitt
Import upstream version 9.1~beta1 |
1077 |
|
1078 |
</refsect1>
|
|
1079 |
||
1080 |
<refsect1>
|
|
1081 |
<title>See Also</title> |
|
1082 |
||
1083 |
<simplelist type="inline"> |
|
1084 |
<member><xref linkend="app-pg-dumpall"></member> |
|
1085 |
<member><xref linkend="app-pgrestore"></member> |
|
1086 |
<member><xref linkend="app-psql"></member> |
|
1087 |
</simplelist>
|
|
1088 |
</refsect1>
|
|
1089 |
||
1090 |
</refentry>
|