From 9067310cc5dd590e36c2c3219dbf3961d7c9f8cb Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 3 Mar 2014 15:02:18 -0300 Subject: pg_dump et al: Add --if-exists option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- doc/src/sgml/ref/pg_dump.sgml | 14 +++++++++++++- doc/src/sgml/ref/pg_dumpall.sgml | 11 +++++++++++ doc/src/sgml/ref/pg_restore.sgml | 14 +++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) (limited to 'doc/src') 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 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 @@ -649,6 +650,17 @@ PostgreSQL documentation + + + + + Use conditional commands (i.e. add an IF EXISTS + clause) when cleaning database objects. This option is not valid + unless + + + 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 @@ -300,6 +300,17 @@ PostgreSQL documentation + + + + + Use conditional commands (i.e. add an IF EXISTS + clause) to clean databases and other objects. This option is not valid + unless + + + 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 @@ Clean (drop) database objects before recreating them. - (This might generate some harmless error messages, if any objects + (Unless @@ -489,6 +490,17 @@ + + + + + Use conditional commands (i.e. add an IF EXISTS + clause) when cleaning database objects. This option is not valid + unless + + + -- cgit v1.2.3