Commit e97e9c57 authored by Tom Lane's avatar Tom Lane

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>
parent 67c6bd1c
...@@ -2552,7 +2552,8 @@ dumpDatabase(Archive *fout) ...@@ -2552,7 +2552,8 @@ dumpDatabase(Archive *fout)
appendPQExpBufferStr(creaQry, " LC_CTYPE = "); appendPQExpBufferStr(creaQry, " LC_CTYPE = ");
appendStringLiteralAH(creaQry, ctype, fout); 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", appendPQExpBuffer(creaQry, " TABLESPACE = %s",
fmtId(tablespace)); fmtId(tablespace));
appendPQExpBufferStr(creaQry, ";\n"); appendPQExpBufferStr(creaQry, ";\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment