aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-09-08 10:48:03 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-09-08 10:48:03 -0400
commit142a110b312fa2d6bbc4eba4df196c35e0caf7bb (patch)
tree5a0898777739ce82bece9a2571a63170bea74717 /src
parent6cdc26e482182a872d10a899cc4bbdb11364720b (diff)
downloadpostgresql-142a110b312fa2d6bbc4eba4df196c35e0caf7bb.tar.gz
postgresql-142a110b312fa2d6bbc4eba4df196c35e0caf7bb.zip
Don't print database's tablespace in pg_dump -C --no-tablespaces output.
If the database has a non-default tablespace, we emitted a TABLESPACE clause in the CREATE DATABASE command emitted by -C, even if --no-tablespaces was also specified. This seems wrong, and it's inconsistent with what pg_dumpall does, so change it. Per bug #14315 from Danylo Hlynskyi. Back-patch to 9.5. The bug is much older, but it'd be a more invasive change before 9.5 because dumpDatabase() hasn't got an easy way to get to the outputNoTablespaces flag. Doesn't seem worth the work given the lack of previous complaints. Report: <20160908081953.1402.75347@wrigleys.postgresql.org>
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_dump/pg_dump.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 715e75c7cad..df6d2e73460 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -2444,7 +2444,8 @@ dumpDatabase(Archive *fout)
appendPQExpBufferStr(creaQry, " LC_CTYPE = ");
appendStringLiteralAH(creaQry, ctype, fout);
}
- if (strlen(tablespace) > 0 && strcmp(tablespace, "pg_default") != 0)
+ if (strlen(tablespace) > 0 && strcmp(tablespace, "pg_default") != 0 &&
+ !dopt->outputNoTablespaces)
appendPQExpBuffer(creaQry, " TABLESPACE = %s",
fmtId(tablespace));
appendPQExpBufferStr(creaQry, ";\n");