aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-10-20 16:58:32 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2012-10-20 16:58:32 -0400
commitedef20f6e1e7a02c65163f1054ce71db4d719aad (patch)
tree5759d200dc3aa65a96053c7017dd2249cf219c08 /doc/src
parentca0b960eb502db429d9134b0ddf24b9e12f45257 (diff)
downloadpostgresql-edef20f6e1e7a02c65163f1054ce71db4d719aad.tar.gz
postgresql-edef20f6e1e7a02c65163f1054ce71db4d719aad.zip
Fix pg_dump's handling of DROP DATABASE commands in --clean mode.
In commit 4317e0246c645f60c39e6572644cff1cb03b4c65, I accidentally broke this behavior while rearranging code to ensure that --create wouldn't affect whether a DATABASE entry gets put into archive-format output. Thus, 9.2 would issue a DROP DATABASE command in --clean mode, which is either useless or dangerous depending on the usage scenario. It should not do that, and no longer does. A bright spot is that this refactoring makes it easy to allow the combination of --clean and --create to work sensibly, ie, emit DROP DATABASE then CREATE DATABASE before reconnecting. Ordinarily we'd consider that a feature addition and not back-patch it, but it seems silly to not include the extra couple of lines required in the 9.2 version of the code. Per report from Guillaume Lelarge, though this is slightly more extensive than his proposed patch.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/ref/pg_dump.sgml9
-rw-r--r--doc/src/sgml/ref/pg_restore.sgml17
2 files changed, 18 insertions, 8 deletions
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index 450383083d7..a10ae0c6227 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -143,7 +143,8 @@ PostgreSQL documentation
<para>
Output commands to clean (drop)
database objects prior to outputting the commands for creating them.
- (Restore might generate some harmless errors.)
+ (Restore might generate some harmless error messages, if any objects
+ were not present in the destination database.)
</para>
<para>
@@ -161,8 +162,10 @@ PostgreSQL documentation
<para>
Begin the output with a command to create the
database itself and reconnect to the created database. (With a
- script of this form, it doesn't matter which database you connect
- to before running the script.)
+ script of this form, it doesn't matter which database in the
+ destination installation you connect to before running the script.)
+ If <option>--clean</option> is also specified, the script drops and
+ recreates the target database before reconnecting to it.
</para>
<para>
diff --git a/doc/src/sgml/ref/pg_restore.sgml b/doc/src/sgml/ref/pg_restore.sgml
index b276da6afe6..d4f61669b88 100644
--- a/doc/src/sgml/ref/pg_restore.sgml
+++ b/doc/src/sgml/ref/pg_restore.sgml
@@ -109,6 +109,8 @@
<listitem>
<para>
Clean (drop) database objects before recreating them.
+ (This might generate some harmless error messages, if any objects
+ were not present in the destination database.)
</para>
</listitem>
</varlistentry>
@@ -118,11 +120,16 @@
<term><option>--create</option></term>
<listitem>
<para>
- Create the database before restoring into it. (When this
- option is used, the database named with <option>-d</option> is
- used only to issue the initial <command>CREATE DATABASE</>
- command. All data is restored into the database name that
- appears in the archive.)
+ Create the database before restoring into it.
+ If <option>--clean</option> is also specified, drop and
+ recreate the target database before connecting to it.
+ </para>
+
+ <para>
+ When this option is used, the database named with <option>-d</option>
+ is used only to issue the initial <command>DROP DATABASE</> and
+ <command>CREATE DATABASE</> commands. All data is restored into the
+ database name that appears in the archive.
</para>
</listitem>
</varlistentry>