Skip to content

Commit 704d7fa

Browse files
committed
Document changed features of pg_dump, including:
- Large Object dumps - Compressed custom format - Requirement to use template0 when creating DB
1 parent ccca223 commit 704d7fa

File tree

1 file changed

+46
-10
lines changed

1 file changed

+46
-10
lines changed

doc/src/sgml/backup.sgml

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/backup.sgml,v 2.4 2000/12/10 20:47:34 momjian Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/backup.sgml,v 2.5 2001/03/13 14:08:18 pjw Exp $ -->
22
<chapter id="backup">
33
<title>Backup and Restore</title>
44

@@ -101,11 +101,11 @@ psql <replaceable class="parameter">dbname</replaceable> &lt; <replaceable class
101101
you used as <replaceable class="parameter">outfile</replaceable>
102102
for the pg_dump command. The database <replaceable
103103
class="parameter">dbname</replaceable> will not be created by this
104-
command, you must do that yourself before executing
105-
<application>psql</> (e.g., with <userinput>createdb <replaceable
106-
class="parameter">dbname</></userinput>). <application>psql</>
107-
supports similar options to <application>pg_dump</> for
108-
controlling the database server location and the user names. See
104+
command, you must create it yourself from template0 before executing
105+
<application>psql</> (e.g., with <userinput>createdb -t template0
106+
<replaceableclass="parameter">dbname</></userinput>).
107+
<application>psql</> supports similar options to <application>pg_dump</>
108+
for controlling the database server location and the user names. See
109109
its reference page for more information.
110110
</para>
111111

@@ -130,6 +130,18 @@ pg_dump -h <replaceable>host1</> <replaceable>dbname</> | psql -h <replaceable>h
130130
</programlisting>
131131
</informalexample>
132132
</para>
133+
134+
135+
<important>
136+
<para>
137+
The dumps produced by pg_dump are relative to template0. This means
138+
that any languages, procedure etc added to template1 will also be
139+
dumped by <application>pg_dump</>. As a result, when restoring, if
140+
you are using a customized template1, you must create the empty
141+
database from template0, as in the example above.
142+
</para>
143+
</important>
144+
133145
</sect2>
134146

135147
<sect2>
@@ -236,6 +248,27 @@ cat <replaceable class="parameter">filename</replaceable>.* | psql <replaceable
236248
</para>
237249
</formalpara>
238250

251+
<formalpara>
252+
<title>Use the custom dump format (V7.1).</title>
253+
<para>
254+
If PostgreSQL was built on a system with the zlib compression library
255+
installed, the custom dump format will compress data as it writes it
256+
to the output file. For large databases, this will produce similar dump
257+
sizes to using gzip, but has the added advantage that the tables can be
258+
restored selectively. The following command dumps a database using the
259+
custom dump format:
260+
261+
<informalexample>
262+
<programlisting>
263+
pg_dump -Fc <replaceable class="parameter">dbname</replaceable> > <replaceable class="parameter">filename</replaceable>
264+
</programlisting>
265+
</informalexample>
266+
267+
See the <application>pg_dump</> and <application>pg_restore</> reference pages for details.
268+
269+
</para>
270+
</formalpara>
271+
239272
</sect2>
240273

241274
<sect2>
@@ -258,10 +291,13 @@ cat <replaceable class="parameter">filename</replaceable>.* | psql <replaceable
258291
</para>
259292

260293
<para>
261-
Large objects are not handled by <application>pg_dump</>. The
262-
directory <filename>contrib/pg_dumplo</> of the
263-
<productname>Postgres</> source tree contains a program that can
264-
do that.
294+
For reasons of backward compatibility, <application>pg_dump</> does
295+
not dump large objects by default. To dump large objects you must use
296+
either custom or TAR output format, and use the -B option in
297+
<application>pg_dump</>. See the reference pages for details.
298+
The directory <filename>contrib/pg_dumplo</> of the
299+
<productname>Postgres</> source tree also contains a program that can
300+
dump large objects.
265301
</para>
266302

267303
<para>

0 commit comments

Comments
 (0)