summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2009-01-13 11:45:03 +0000
committerMagnus Hagander <magnus@hagander.net>2009-01-13 11:45:03 +0000
commit4d4b0f35210bc7c83b73fc4e001e8873982de722 (patch)
treedb0e32df8ee643e5124abb9ed7878356154032c9
parent74216bc8c88c2b8693f0b9b34331c0414d8b9795 (diff)
Throw an error when using -C and -1 at the same time in pg_restore.
It's not possible to do CREATE DATABASE inside a transaction, so previously we just got a server error instead. Backpatch to 8.2, which is where the -1 feature appeared.
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index af44e852513..880fbf1c6cd 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.152 2008/01/14 19:27:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.152.2.1 2009/01/13 11:45:03 mha Exp $
*
*-------------------------------------------------------------------------
*/
@@ -146,6 +146,12 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
*/
if (ropt->create && ropt->dropSchema)
die_horribly(AH, modulename, "-C and -c are incompatible options\n");
+ /*
+ * -1 is not compatible with -C, because we can't create a database
+ * inside a transaction block.
+ */
+ if (ropt->create && ropt->single_txn)
+ die_horribly(AH, modulename, "-C and -1 are incompatible options\n");
/*
* If we're using a DB connection, then connect it.