mirror of
https://github.com/postgres/postgres.git
synced 2025-07-20 05:03:10 +03:00
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.
This commit is contained in:
@ -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");
|
||||
|
||||
|
Reference in New Issue
Block a user