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

Commite8ccae5

Browse files
committed
Doc: improve description of dump/restore's --clean and --if-exists.
Try to make these option descriptions a little clearer for novices.Per gripe from Attila Gulyás.Discussion:https://postgr.es/m/169590536647.3727336.11070254203649648453@wrigleys.postgresql.org
1 parent0ae01cc commite8ccae5

File tree

3 files changed

+32
-20
lines changed

3 files changed

+32
-20
lines changed

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,12 @@ PostgreSQL documentation
168168
<term><option>--clean</option></term>
169169
<listitem>
170170
<para>
171-
Output commands toclean (drop)
171+
Output commands to<command>DROP</command> all the dumped
172172
database objects prior to outputting the commands for creating them.
173-
(Unless <option>--if-exists</option> is also specified,
174-
restore might generate some harmless error messages, if any objects
175-
were not present in the destination database.)
173+
This option is useful when the restore is to overwrite an existing
174+
database. If any of the objects do not exist in the destination
175+
database, ignorable error messages will be reported during
176+
restore, unless <option>--if-exists</option> is also specified.
176177
</para>
177178

178179
<para>
@@ -793,9 +794,11 @@ PostgreSQL documentation
793794
<term><option>--if-exists</option></term>
794795
<listitem>
795796
<para>
796-
Use conditional commands (i.e., add an <literal>IF EXISTS</literal>
797-
clause) when cleaning database objects. This option is not valid
798-
unless <option>--clean</option> is also specified.
797+
Use <literal>DROP ... IF EXISTS</literal> commands to drop objects
798+
in <option>--clean</option> mode. This suppresses <quote>does not
799+
exist</quote> errors that might otherwise be reported. This
800+
option is not valid unless <option>--clean</option> is also
801+
specified.
799802
</para>
800803
</listitem>
801804
</varlistentry>

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,12 @@ PostgreSQL documentation
9090
<term><option>--clean</option></term>
9191
<listitem>
9292
<para>
93-
Include SQL commands to clean (drop) databases before
94-
recreating them. <command>DROP</command> commands for roles and
95-
tablespaces are added as well.
93+
Emit SQL commands to <command>DROP</command> all the dumped
94+
databases, roles, and tablespaces before recreating them.
95+
This option is useful when the restore is to overwrite an existing
96+
cluster. If any of the objects do not exist in the destination
97+
cluster, ignorable error messages will be reported during
98+
restore, unless <option>--if-exists</option> is also specified.
9699
</para>
97100
</listitem>
98101
</varlistentry>
@@ -323,9 +326,11 @@ PostgreSQL documentation
323326
<term><option>--if-exists</option></term>
324327
<listitem>
325328
<para>
326-
Use conditional commands (i.e., add an <literal>IF EXISTS</literal>
327-
clause) to drop databases and other objects. This option is not valid
328-
unless <option>--clean</option> is also specified.
329+
Use <literal>DROP ... IF EXISTS</literal> commands to drop objects
330+
in <option>--clean</option> mode. This suppresses <quote>does not
331+
exist</quote> errors that might otherwise be reported. This
332+
option is not valid unless <option>--clean</option> is also
333+
specified.
329334
</para>
330335
</listitem>
331336
</varlistentry>

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,12 @@ PostgreSQL documentation
111111
<term><option>--clean</option></term>
112112
<listitem>
113113
<para>
114-
Clean (drop) database objects before recreating them.
115-
(Unless <option>--if-exists</option> is used,
116-
this might generate some harmless error messages, if any objects
117-
were not present in the destination database.)
114+
Before restoring database objects, issue commands
115+
to <command>DROP</command> all the objects that will be restored.
116+
This option is useful for overwriting an existing database.
117+
If any of the objects do not exist in the destination database,
118+
ignorable error messages will be reported,
119+
unless <option>--if-exists</option> is also specified.
118120
</para>
119121
</listitem>
120122
</varlistentry>
@@ -580,9 +582,11 @@ PostgreSQL documentation
580582
<term><option>--if-exists</option></term>
581583
<listitem>
582584
<para>
583-
Use conditional commands (i.e., add an <literal>IF EXISTS</literal>
584-
clause) to drop database objects. This option is not valid
585-
unless <option>--clean</option> is also specified.
585+
Use <literal>DROP ... IF EXISTS</literal> commands to drop objects
586+
in <option>--clean</option> mode. This suppresses <quote>does not
587+
exist</quote> errors that might otherwise be reported. This
588+
option is not valid unless <option>--clean</option> is also
589+
specified.
586590
</para>
587591
</listitem>
588592
</varlistentry>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp