Skip to content

Commit 906254a

Browse files
committed
pg_dump and pg_restore man pages need to mention that one should restore
into a virgin database, ie, one created from template0, if there are any site-local additions in template1.
1 parent d99fb0d commit 906254a

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

doc/src/sgml/ref/pg_dump.sgml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.41 2001/12/08 03:24:37 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.42 2002/02/11 00:14:10 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -603,8 +603,21 @@ connectDBStart() -- connect() failed: No such file or directory
603603

604604
<refsect1 id="pg-dump-notes">
605605
<title>Notes</title>
606+
607+
<para>
608+
If your installation has any local additions to the template1 database,
609+
be careful to restore the output of <command>pg_dump</command> into a
610+
truly empty database; otherwise you are likely to get errors due to
611+
duplicate definitions of the added objects. To make an empty database
612+
without any local additions, copy from template0 not template1,
613+
for example:
614+
<programlisting>
615+
CREATE DATABASE foo WITH TEMPLATE = template0;
616+
</programlisting>
617+
</para>
618+
606619
<para>
607-
<command>pg_dump</command> has a few limitations.
620+
<command>pg_dump</command> has a few limitations:
608621

609622
<itemizedlist>
610623
<listitem>

doc/src/sgml/ref/pg_restore.sgml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.21 2001/11/28 20:49:10 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.22 2002/02/11 00:14:10 tgl Exp $ -->
22

33
<refentry id="APP-PGRESTORE">
44
<docinfo>
@@ -513,13 +513,25 @@ connectDBStart() -- connect() failed: No such file or directory
513513
Notes
514514
</title>
515515

516+
<para>
517+
If your installation has any local additions to the template1 database,
518+
be careful to load the output of <command>pg_restore</command> into a
519+
truly empty database; otherwise you are likely to get errors due to
520+
duplicate definitions of the added objects. To make an empty database
521+
without any local additions, copy from template0 not template1,
522+
for example:
523+
<programlisting>
524+
CREATE DATABASE foo WITH TEMPLATE = template0;
525+
</programlisting>
526+
</para>
527+
516528
<para>
517529
The limitations of <command>pg_restore</command> are detailed below.
518530

519531
<itemizedlist>
520532
<listitem>
521533
<para>
522-
When restoring data to a table, <command>pg_restore</command> emits queries
534+
When restoring data to a pre-existing table, <command>pg_restore</command> emits queries
523535
to disable triggers on user tables before inserting the data then emits queries to
524536
re-enable them after the data has been inserted. If the restore is stopped in the
525537
middle, the system catalogs may be left in the wrong state.
@@ -538,7 +550,7 @@ connectDBStart() -- connect() failed: No such file or directory
538550

539551
<para>
540552
See the <xref linkend="app-pgdump"> documentation for details on
541-
limitation of <command>pg_dump</command>.
553+
limitations of <command>pg_dump</command>.
542554
</para>
543555
</refsect1>
544556

0 commit comments

Comments
 (0)