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

Commit7a28de2

Browse files
committed
pg_dump can now dump large objects even in plain-text output mode, by
using the recently added lo_create() function. The restore logic inpg_restore is greatly simplified as well, since there's no need anymoreto try to adjust database references to match a new set of blob OIDs.
1 parentb49d871 commit7a28de2

15 files changed

+255
-586
lines changed

‎doc/src/sgml/backup.sgml

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/backup.sgml,v 2.67 2005/06/2104:02:29 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/backup.sgml,v 2.68 2005/06/2120:45:43 tgl Exp $
33
-->
44
<chapter id="backup">
55
<title>Backup and Restore</title>
@@ -88,9 +88,7 @@ pg_dump <replaceable class="parameter">dbname</replaceable> &gt; <replaceable cl
8888
When your database schema relies on OIDs (for instance as foreign
8989
keys) you must instruct <application>pg_dump</> to dump the OIDs
9090
as well. To do this, use the <option>-o</option> command line
91-
option. <quote>Large objects</> are not dumped by default,
92-
either. See <xref linkend="app-pgdump">'s reference page if you
93-
use large objects.
91+
option.
9492
</para>
9593
</important>
9694

@@ -267,28 +265,6 @@ pg_dump -Fc <replaceable class="parameter">dbname</replaceable> &gt; <replaceabl
267265
</formalpara>
268266

269267
</sect2>
270-
271-
<sect2 id="backup-dump-caveats">
272-
<title>Caveats</title>
273-
274-
<para>
275-
For reasons of backward compatibility, <application>pg_dump</>
276-
does not dump large objects by default.<indexterm><primary>large
277-
object</primary><secondary>backup</secondary></indexterm> To dump
278-
large objects you must use either the custom or the tar output
279-
format, and use the <option>-b</> option in
280-
<application>pg_dump</>. See the <xref linkend="app-pgdump"> reference
281-
page for details. The
282-
directory <filename>contrib/pg_dumplo</> of the
283-
<productname>PostgreSQL</> source tree also contains a program
284-
that can dump large objects.
285-
</para>
286-
287-
<para>
288-
Please familiarize yourself with the <xref linkend="app-pgdump">
289-
reference page.
290-
</para>
291-
</sect2>
292268
</sect1>
293269

294270
<sect1 id="backup-file">

‎doc/src/sgml/installation.sgml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.236 2005/06/2104:02:29 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.237 2005/06/2120:45:43 tgl Exp $ -->
22

33
<chapter id="installation">
44
<title><![%standalone-include[<productname>PostgreSQL</>]]>
@@ -389,14 +389,6 @@ su - postgres
389389
<application>pg_dumpall</>.
390390
</para>
391391

392-
<para>
393-
<application>pg_dumpall</application> does not
394-
save large objects. Check
395-
<![%standalone-include[the documentation]]>
396-
<![%standalone-ignore[<xref linkend="backup-dump-caveats">]]>
397-
if you need to do this.
398-
</para>
399-
400392
<para>
401393
To make the backup, you can use the <application>pg_dumpall</application>
402394
command from the version you are currently running. For best

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

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.77 2005/05/29 03:32:18 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.78 2005/06/21 20:45:43 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -60,9 +60,8 @@ PostgreSQL documentation
6060
<xref linkend="app-pgrestore"> to rebuild the database. They
6161
allow <application>pg_restore</application> to be selective about
6262
what is restored, or even to reorder the items prior to being
63-
restored. The archive formats also allow saving and restoring
64-
<quote>large objects</>, which is not possible in a script dump.
65-
The archive files are also designed to be portable across
63+
restored.
64+
The archive file formats are designed to be portable across
6665
architectures.
6766
</para>
6867

@@ -127,17 +126,6 @@ PostgreSQL documentation
127126
</listitem>
128127
</varlistentry>
129128

130-
<varlistentry>
131-
<term><option>-b</></term>
132-
<term><option>--blobs</></term>
133-
<listitem>
134-
<para>
135-
Include large objects in the dump. A non-text output format
136-
must be selected.
137-
</para>
138-
</listitem>
139-
</varlistentry>
140-
141129
<varlistentry>
142130
<term><option>-c</option></term>
143131
<term><option>--clean</option></term>
@@ -600,14 +588,6 @@ CREATE DATABASE foo WITH TEMPLATE template0;
600588
<application>pg_dump</application> has a few limitations:
601589

602590
<itemizedlist>
603-
<listitem>
604-
<para>
605-
When dumping a single table or as plain text, <application>pg_dump</application>
606-
does not handle large objects. Large objects must be dumped with the
607-
entire database using one of the non-text archive formats.
608-
</para>
609-
</listitem>
610-
611591
<listitem>
612592
<para>
613593
When a data-only dump is chosen and the option
@@ -660,17 +640,16 @@ CREATE DATABASE foo WITH TEMPLATE template0;
660640
</para>
661641

662642
<para>
663-
To dump a database called <literal>mydb</>that contains
664-
large objects to a <filename>tar</filename>file:
643+
To dump a database called <literal>mydb</>to a <filename>tar</filename>
644+
file:
665645

666646
<screen>
667-
<prompt>$</prompt> <userinput>pg_dump -Ft-bmydb &gt; db.tar</userinput>
647+
<prompt>$</prompt> <userinput>pg_dump -Ft mydb &gt; db.tar</userinput>
668648
</screen>
669649
</para>
670650

671651
<para>
672-
To reload this database (with large objects) to an
673-
existing database called <literal>newdb</>:
652+
To reload this dump into an existing database called <literal>newdb</>:
674653

675654
<screen>
676655
<prompt>$</prompt> <userinput>pg_restore -d newdb db.tar</userinput>

‎doc/src/sgml/ref/pg_dumpall.sgml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.50 2005/06/2104:02:31 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.51 2005/06/2120:45:43 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -43,16 +43,6 @@ PostgreSQL documentation
4343
groups, and access permissions that apply to databases as a whole.
4444
</para>
4545

46-
<para>
47-
Thus, <application>pg_dumpall</application> is an integrated
48-
solution for backing up your databases. But note a limitation:
49-
it cannot dump <quote>large objects</quote>, since
50-
<application>pg_dump</application> cannot dump such objects into
51-
text files. If you have databases containing large objects,
52-
they should be dumped using one of <application>pg_dump</application>'s
53-
non-text output modes.
54-
</para>
55-
5646
<para>
5747
Since <application>pg_dumpall</application> reads tables from all
5848
databases you will most likely have to connect as a database

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

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.52 2005/06/09 17:56:51 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.53 2005/06/21 20:45:43 tgl Exp $ -->
22

33
<refentry id="APP-PGRESTORE">
44
<refmeta>
@@ -44,14 +44,13 @@
4444
</para>
4545

4646
<para>
47-
<application>pg_restore</application> can operate in two modes: If
48-
a database name is specified, the archive is restored directly into
49-
the database. (Large objects can only be restored by using such a direct
50-
database connection.) Otherwise, a script containing the SQL
51-
commands necessary to rebuild the database is created (and written
52-
to a file or standard output), similar to the ones created by the
53-
<application>pg_dump</application> plain text format. Some of the
54-
options controlling the script output are therefore analogous to
47+
<application>pg_restore</application> can operate in two modes.
48+
If a database name is specified, the archive is restored directly into
49+
the database. Otherwise, a script containing the SQL
50+
commands necessary to rebuild the database is created and written
51+
to a file or standard output. The script output is equivalent to
52+
the plain text output format of <application>pg_dump</application>.
53+
Some of the options controlling the output are therefore analogous to
5554
<application>pg_dump</application> options.
5655
</para>
5756

@@ -541,16 +540,16 @@ CREATE DATABASE foo WITH TEMPLATE template0;
541540
<title>Examples</title>
542541

543542
<para>
544-
To dump a database called <literal>mydb</>that contains
545-
large objects to a <filename>tar</filename>file:
543+
To dump a database called <literal>mydb</>to a <filename>tar</filename>
544+
file:
546545

547546
<screen>
548-
<prompt>$</prompt> <userinput>pg_dump -Ft-bmydb &gt; db.tar</userinput>
547+
<prompt>$</prompt> <userinput>pg_dump -Ft mydb &gt; db.tar</userinput>
549548
</screen>
550549
</para>
551550

552551
<para>
553-
To reload thisdatabase (with large objects) to an
552+
To reload thisdump into an
554553
existing database called <literal>newdb</>:
555554

556555
<screen>

‎src/bin/pg_dump/README

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ Notes on pg_dump
55

66
2. pg_dumpall forces all pg_dump output to be text, since it also outputs text into the same output stream.
77

8-
3. The plain text output formatcan not be used as input into pg_restore.
8+
3. The plain text output formatcannot be used as input into pg_restore.
99

10-
4. pg_dump now dumps the items in a modified OID order to try to improve relaibility of default restores.
1110

12-
13-
To dump a database into the next custom format, type:
11+
To dump a database into the new custom format, type:
1412

1513
pg_dump <db-name> -Fc > <backup-file>
1614

17-
or, in TAR format
15+
or,to dumpin TAR format
1816

1917
pg_dump <db-name> -Ft > <backup-file>
2018

@@ -28,7 +26,7 @@ To restore, try
2826

2927
pg_restore <backup-file> --table | less
3028

31-
or to list in adiffernet orderL
29+
or to list in adifferent order
3230

3331
pg_restore <backup-file> -l --oid --rearrange | less
3432

@@ -59,27 +57,12 @@ or, simply:
5957
pg_restore backup.bck --use=toc.lis | psql newdbname
6058

6159

62-
BLOBs
63-
=====
64-
65-
To dump blobs you must use the custom archive format (-Fc) or TAR format (-Ft), and specify the
66-
--blobs qualifier to the pg_dump command.
67-
68-
To restore blobs you must use a direct database connection (--db=db-to-restore-to).
69-
70-
eg.
71-
72-
pg_dump --blob -Fc db-to-backup -f backup.bck
73-
74-
pg_restore backup.bck --db=db-to-restore-into
75-
76-
7760
TAR
7861
===
7962

8063
The TAR archive that pg_dump creates currently has a blank username & group for the files,
8164
but should be otherwise valid. It also includes a 'restore.sql' script which is there for
82-
the benefit of humans.It is never used by pg_restore.
65+
the benefit of humans.The script is never used by pg_restore.
8366

8467
Note: the TAR format archive can only be used as input into pg_restore if it is in TAR form.
8568
(ie. you should not extract the files then expect pg_restore to work).
@@ -91,6 +74,3 @@ the BLOB files at the end.
9174

9275
Philip Warner, 16-Jul-2000
9376
pjw@rhyme.com.au
94-
95-
96-

‎src/bin/pg_dump/pg_backup.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup.h,v 1.35 2005/06/09 17:56:51 momjian Exp $
18+
*$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup.h,v 1.36 2005/06/21 20:45:44 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -152,10 +152,6 @@ extern void ArchiveEntry(Archive *AHX,
152152
/* Called to write *data* to the archive */
153153
externsize_tWriteData(Archive*AH,constvoid*data,size_tdLen);
154154

155-
/*
156-
extern intStartBlobs(Archive* AH);
157-
extern intEndBlobs(Archive* AH);
158-
*/
159155
externintStartBlob(Archive*AH,Oidoid);
160156
externintEndBlob(Archive*AH,Oidoid);
161157

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp