Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7f508f1

Browse files
committed
Add 'directory' format to pg_dump. The new directory format is compatible
with the 'tar' format, in that untarring a tar format archive produces avalid directory format archive.Joachim Wieland and Heikki Linnakangas
1 parentf369207 commit7f508f1

File tree

12 files changed

+1132
-55
lines changed

12 files changed

+1132
-55
lines changed

‎doc/src/sgml/ref/pg_dump.sgml

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,7 @@ PostgreSQL documentation
7676
database are to be restored. The most flexible output file format is
7777
the <quote>custom</quote> format (<option>-Fc</option>). It allows
7878
for selection and reordering of all archived items, and is compressed
79-
by default. The <application>tar</application> format
80-
(<option>-Ft</option>) is not compressed and has restrictions on
81-
reordering data when loading, but it is otherwise quite flexible;
82-
moreover, it can be manipulated with standard Unix tools such as
83-
<command>tar</command>.
79+
by default.
8480
</para>
8581

8682
<para>
@@ -194,8 +190,12 @@ PostgreSQL documentation
194190
<term><option>--file=<replaceable class="parameter">file</replaceable></option></term>
195191
<listitem>
196192
<para>
197-
Send output to the specified file. If this is omitted, the
198-
standard output is used.
193+
Send output to the specified file. This parameter can be omitted for
194+
file based output formats, in which case the standard output is used.
195+
It must be given for the directory output format however, where it
196+
specifies the target directory instead of a file. In this case the
197+
directory is created by <command>pg_dump</command> and must not exist
198+
before.
199199
</para>
200200
</listitem>
201201
</varlistentry>
@@ -226,9 +226,28 @@ PostgreSQL documentation
226226
<para>
227227
Output a custom-format archive suitable for input into
228228
<application>pg_restore</application>.
229-
This is the most flexible output format in that it allows manual
230-
selection and reordering of archived items during restore.
231-
This format is also compressed by default.
229+
Together with the directory output format, this is the most flexible
230+
output format in that it allows manual selection and reordering of
231+
archived items during restore. This format is also compressed by
232+
default.
233+
</para>
234+
</listitem>
235+
</varlistentry>
236+
237+
<varlistentry>
238+
<term><literal>d</></term>
239+
<term><literal>directory</></term>
240+
<listitem>
241+
<para>
242+
Output a directory-format archive suitable for input into
243+
<application>pg_restore</application>. This will create a directory
244+
with one file for each table and blob being dumped, plus a
245+
so-called Table of Contents file describing the dumped objects in a
246+
machine-readable format that <application>pg_restore</application>
247+
can read. A directory format archive can be manipulated with
248+
standard Unix tools; for example, files in an uncompressed archive
249+
can be compressed with the <application>gzip</application> tool.
250+
This format is compressed by default.
232251
</para>
233252
</listitem>
234253
</varlistentry>
@@ -239,13 +258,12 @@ PostgreSQL documentation
239258
<listitem>
240259
<para>
241260
Output a <command>tar</command>-format archive suitable for input
242-
into <application>pg_restore</application>.
243-
This output format allows manual selection and reordering of
244-
archived items during restore, but there is a restriction: the
245-
relative order of table data items cannot be changed during
246-
restore. Also, <command>tar</command> format does not support
247-
compression and has a limit of 8 GB on the size of individual
248-
tables.
261+
into <application>pg_restore</application>. The tar-format is
262+
compatible with the directory-format; extracting a tar-format
263+
archive produces a valid directory-format archive.
264+
However, the tar-format does not support compression and has a
265+
limit of 8 GB on the size of individual tables. Also, the relative
266+
order of table data items cannot be changed during restore.
249267
</para>
250268
</listitem>
251269
</varlistentry>
@@ -946,6 +964,14 @@ CREATE DATABASE foo WITH TEMPLATE template0;
946964
</screen>
947965
</para>
948966

967+
<para>
968+
To dump a database into a directory-format archive:
969+
970+
<screen>
971+
<prompt>$</prompt> <userinput>pg_dump -Fd mydb -f dumpdir</userinput>
972+
</screen>
973+
</para>
974+
949975
<para>
950976
To reload an archive file into a (freshly created) database named
951977
<literal>newdb</>:

‎doc/src/sgml/ref/pg_restore.sgml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@
7979
<term><replaceable class="parameter">filename</replaceable></term>
8080
<listitem>
8181
<para>
82-
Specifies the location of the archive file to be restored.
82+
Specifies the location of the archive file (or directory, for a
83+
directory-format archive) to be restored.
8384
If not specified, the standard input is used.
8485
</para>
8586
</listitem>
@@ -166,6 +167,16 @@
166167
one of the following:
167168

168169
<variablelist>
170+
<varlistentry>
171+
<term><literal>d</></term>
172+
<term><literal>directory</></term>
173+
<listitem>
174+
<para>
175+
The archive is a <command>directory</command> archive.
176+
</para>
177+
</listitem>
178+
</varlistentry>
179+
169180
<varlistentry>
170181
<term><literal>t</></term>
171182
<term><literal>tar</></term>

‎src/bin/pg_dump/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
2020

2121
OBJS=pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o\
2222
pg_backup_files.o pg_backup_null.o pg_backup_tar.o\
23-
dumputils.o compress_io.o$(WIN32RES)
23+
pg_backup_directory.odumputils.o compress_io.o$(WIN32RES)
2424

2525
KEYWRDOBJS = keywords.o kwlookup.o
2626

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp