Forbid the switch combination --clean --create, which is pointless

(why bother dropping individual objects in a just-created database?)
as well as dangerous (as the code stands, the drops will be issued in
the wrong database, namely the one you were originally connected to).
This commit is contained in:
Tom Lane 2001-10-23 21:26:44 +00:00
parent 2628d9b3a4
commit b662e321c5
1 changed files with 12 additions and 1 deletions

View File

@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.33 2001/09/21 21:58:30 petere Exp $
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.34 2001/10/23 21:26:44 tgl Exp $
*
* Modifications - 28-Jun-2000 - pjw@rhyme.com.au
*
@ -162,9 +162,20 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
AH->ropt = ropt;
/*
* Check for nonsensical option combinations.
*
* NB: create+dropSchema is useless because if you're creating the DB,
* there's no need to drop individual items in it. Moreover, if we
* tried to do that then we'd issue the drops in the database initially
* connected to, not the one we will create, which is very bad...
*/
if (ropt->create && ropt->noReconnect)
die_horribly(AH, modulename, "-C and -R are incompatible options\n");
if (ropt->create && ropt->dropSchema)
die_horribly(AH, modulename, "-C and -c are incompatible options\n");
/*
* If we're using a DB connection, then connect it.
*/