diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-03-20 17:36:58 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-03-20 17:36:58 +0000 |
commit | 68528d37bbfbb3ae8dc83418f3e1d343c4050f0a (patch) | |
tree | 1244e805a429b9e4f3a34dd51318b185152c1c7c /src/bin/pg_dump/pg_backup_archiver.c | |
parent | f9e083fd30526e9e7a1c0e5a42366d5cc012d2a7 (diff) | |
download | postgresql-68528d37bbfbb3ae8dc83418f3e1d343c4050f0a.tar.gz postgresql-68528d37bbfbb3ae8dc83418f3e1d343c4050f0a.zip |
Support a --no-tablespaces option in pg_dump/pg_dumpall/pg_restore, so that
dumps can be loaded into databases without the same tablespaces that the
source had. The option acts by suppressing all "SET default_tablespace"
commands, and also CREATE TABLESPACE commands in pg_dumpall's case.
Gavin Roy, with documentation and minor fixes by me.
Diffstat (limited to 'src/bin/pg_dump/pg_backup_archiver.c')
-rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index af44e852513..7c36aef5484 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.153 2008/03/20 17:36:57 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2378,6 +2378,10 @@ _selectTablespace(ArchiveHandle *AH, const char *tablespace) const char *want, *have; + /* do nothing in --no-tablespaces mode */ + if (AH->ropt->noTablespace) + return; + have = AH->currTablespace; want = tablespace; @@ -2578,7 +2582,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat pfx, te->tag, te->desc, te->namespace ? te->namespace : "-", ropt->noOwner ? "-" : te->owner); - if (te->tablespace) + if (te->tablespace && !ropt->noTablespace) ahprintf(AH, "; Tablespace: %s", te->tablespace); ahprintf(AH, "\n"); |