aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2014-03-03 15:02:18 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2014-03-03 15:02:18 -0300
commit9067310cc5dd590e36c2c3219dbf3961d7c9f8cb (patch)
treee459d434c156d80a8b51fba86308d637fce6bfac /doc/src
parent34c6d9611d23178539ed09b8f2ce40c5788a21cb (diff)
downloadpostgresql-9067310cc5dd590e36c2c3219dbf3961d7c9f8cb.tar.gz
postgresql-9067310cc5dd590e36c2c3219dbf3961d7c9f8cb.zip
pg_dump et al: Add --if-exists option
This option makes pg_dump, pg_dumpall and pg_restore inject an IF EXISTS clause to each DROP command they emit. (In pg_dumpall, the clause is not added to individual objects drops, but rather to the CREATE DATABASE commands, as well as CREATE ROLE and CREATE TABLESPACE.) This allows for a better user dump experience when using --clean in case some objects do not already exist. Per bug #7873 by Dave Rolsky. Author: Pavel Stěhule Reviewed-by: Jeevan Chalke, Álvaro Herrera, Josh Kupershmidt
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/ref/pg_dump.sgml14
-rw-r--r--doc/src/sgml/ref/pg_dumpall.sgml11
-rw-r--r--doc/src/sgml/ref/pg_restore.sgml14
3 files changed, 37 insertions, 2 deletions
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index 40c69f05421..1f0d4ded32e 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -145,7 +145,8 @@ PostgreSQL documentation
<para>
Output commands to clean (drop)
database objects prior to outputting the commands for creating them.
- (Restore might generate some harmless error messages, if any objects
+ (Unless <option>--if-exists</> is also specified,
+ restore might generate some harmless error messages, if any objects
were not present in the destination database.)
</para>
@@ -650,6 +651,17 @@ PostgreSQL documentation
</varlistentry>
<varlistentry>
+ <term><option>--if-exists</option></term>
+ <listitem>
+ <para>
+ Use conditional commands (i.e. add an <literal>IF EXISTS</literal>
+ clause) when cleaning database objects. This option is not valid
+ unless <option>--clean</> is also specified.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--disable-dollar-quoting</></term>
<listitem>
<para>
diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml
index f33793985f9..fcf5f77a6db 100644
--- a/doc/src/sgml/ref/pg_dumpall.sgml
+++ b/doc/src/sgml/ref/pg_dumpall.sgml
@@ -301,6 +301,17 @@ PostgreSQL documentation
</varlistentry>
<varlistentry>
+ <term><option>--if-exists</option></term>
+ <listitem>
+ <para>
+ Use conditional commands (i.e. add an <literal>IF EXISTS</literal>
+ clause) to clean databases and other objects. This option is not valid
+ unless <option>--clean</> is also specified.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--inserts</option></term>
<listitem>
<para>
diff --git a/doc/src/sgml/ref/pg_restore.sgml b/doc/src/sgml/ref/pg_restore.sgml
index cd60b2558a4..4bc30ce679b 100644
--- a/doc/src/sgml/ref/pg_restore.sgml
+++ b/doc/src/sgml/ref/pg_restore.sgml
@@ -109,7 +109,8 @@
<listitem>
<para>
Clean (drop) database objects before recreating them.
- (This might generate some harmless error messages, if any objects
+ (Unless <option>--if-exists</> is used,
+ this might generate some harmless error messages, if any objects
were not present in the destination database.)
</para>
</listitem>
@@ -490,6 +491,17 @@
</varlistentry>
<varlistentry>
+ <term><option>--if-exists</option></term>
+ <listitem>
+ <para>
+ Use conditional commands (i.e. add an <literal>IF EXISTS</literal>
+ clause) when cleaning database objects. This option is not valid
+ unless <option>--clean</> is also specified.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--no-data-for-failed-tables</option></term>
<listitem>
<para>