1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Add 'directory' format to pg_dump. The new directory format is compatible

with the 'tar' format, in that untarring a tar format archive produces a
valid directory format archive.

Joachim Wieland and Heikki Linnakangas
This commit is contained in:
Heikki Linnakangas
2011-01-23 23:10:15 +02:00
parent f36920796e
commit 7f508f1c6b
12 changed files with 1134 additions and 57 deletions

View File

@ -76,11 +76,7 @@ PostgreSQL documentation
database are to be restored. The most flexible output file format is
the <quote>custom</quote> format (<option>-Fc</option>). It allows
for selection and reordering of all archived items, and is compressed
by default. The <application>tar</application> format
(<option>-Ft</option>) is not compressed and has restrictions on
reordering data when loading, but it is otherwise quite flexible;
moreover, it can be manipulated with standard Unix tools such as
<command>tar</command>.
by default.
</para>
<para>
@ -194,8 +190,12 @@ PostgreSQL documentation
<term><option>--file=<replaceable class="parameter">file</replaceable></option></term>
<listitem>
<para>
Send output to the specified file. If this is omitted, the
standard output is used.
Send output to the specified file. This parameter can be omitted for
file based output formats, in which case the standard output is used.
It must be given for the directory output format however, where it
specifies the target directory instead of a file. In this case the
directory is created by <command>pg_dump</command> and must not exist
before.
</para>
</listitem>
</varlistentry>
@ -226,9 +226,28 @@ PostgreSQL documentation
<para>
Output a custom-format archive suitable for input into
<application>pg_restore</application>.
This is the most flexible output format in that it allows manual
selection and reordering of archived items during restore.
This format is also compressed by default.
Together with the directory output format, this is the most flexible
output format in that it allows manual selection and reordering of
archived items during restore. This format is also compressed by
default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>d</></term>
<term><literal>directory</></term>
<listitem>
<para>
Output a directory-format archive suitable for input into
<application>pg_restore</application>. This will create a directory
with one file for each table and blob being dumped, plus a
so-called Table of Contents file describing the dumped objects in a
machine-readable format that <application>pg_restore</application>
can read. A directory format archive can be manipulated with
standard Unix tools; for example, files in an uncompressed archive
can be compressed with the <application>gzip</application> tool.
This format is compressed by default.
</para>
</listitem>
</varlistentry>
@ -239,13 +258,12 @@ PostgreSQL documentation
<listitem>
<para>
Output a <command>tar</command>-format archive suitable for input
into <application>pg_restore</application>.
This output format allows manual selection and reordering of
archived items during restore, but there is a restriction: the
relative order of table data items cannot be changed during
restore. Also, <command>tar</command> format does not support
compression and has a limit of 8 GB on the size of individual
tables.
into <application>pg_restore</application>. The tar-format is
compatible with the directory-format; extracting a tar-format
archive produces a valid directory-format archive.
However, the tar-format does not support compression and has a
limit of 8 GB on the size of individual tables. Also, the relative
order of table data items cannot be changed during restore.
</para>
</listitem>
</varlistentry>
@ -946,6 +964,14 @@ CREATE DATABASE foo WITH TEMPLATE template0;
</screen>
</para>
<para>
To dump a database into a directory-format archive:
<screen>
<prompt>$</prompt> <userinput>pg_dump -Fd mydb -f dumpdir</userinput>
</screen>
</para>
<para>
To reload an archive file into a (freshly created) database named
<literal>newdb</>:

View File

@ -79,7 +79,8 @@
<term><replaceable class="parameter">filename</replaceable></term>
<listitem>
<para>
Specifies the location of the archive file to be restored.
Specifies the location of the archive file (or directory, for a
directory-format archive) to be restored.
If not specified, the standard input is used.
</para>
</listitem>
@ -166,6 +167,16 @@
one of the following:
<variablelist>
<varlistentry>
<term><literal>d</></term>
<term><literal>directory</></term>
<listitem>
<para>
The archive is a <command>directory</command> archive.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>t</></term>
<term><literal>tar</></term>