Skip to content

Commit e97e9c5

Browse files
committed
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>
1 parent 67c6bd1 commit e97e9c5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bin/pg_dump/pg_dump.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2552,7 +2552,8 @@ dumpDatabase(Archive *fout)
25522552
appendPQExpBufferStr(creaQry, " LC_CTYPE = ");
25532553
appendStringLiteralAH(creaQry, ctype, fout);
25542554
}
2555-
if (strlen(tablespace) > 0 && strcmp(tablespace, "pg_default") != 0)
2555+
if (strlen(tablespace) > 0 && strcmp(tablespace, "pg_default") != 0 &&
2556+
!dopt->outputNoTablespaces)
25562557
appendPQExpBuffer(creaQry, " TABLESPACE = %s",
25572558
fmtId(tablespace));
25582559
appendPQExpBufferStr(creaQry, ";\n");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy