diff options
author | Magnus Hagander <magnus@hagander.net> | 2009-01-13 11:45:01 +0000 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2009-01-13 11:45:01 +0000 |
commit | 63ca96af30cdc79cecfdacc4bbe5913974d19b6e (patch) | |
tree | a3928141d06a3c4ff5ae7f6d06c7da630ab75f21 /src | |
parent | c165c25a662e4fcbb475c0d71d85e84ce27d6fa5 (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.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.c | 8 |
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 dca87e94cf7..67c72ab2df3 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.138.2.2 2007/08/06 01:38:24 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.138.2.3 2009/01/13 11:45:01 mha Exp $ * *------------------------------------------------------------------------- */ @@ -147,6 +147,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. |