Skip to content

Commit 142a110

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 6cdc26e commit 142a110

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
@@ -2444,7 +2444,8 @@ dumpDatabase(Archive *fout)
24442444
appendPQExpBufferStr(creaQry, " LC_CTYPE = ");
24452445
appendStringLiteralAH(creaQry, ctype, fout);
24462446
}
2447-
if (strlen(tablespace) > 0 && strcmp(tablespace, "pg_default") != 0)
2447+
if (strlen(tablespace) > 0 && strcmp(tablespace, "pg_default") != 0 &&
2448+
!dopt->outputNoTablespaces)
24482449
appendPQExpBuffer(creaQry, " TABLESPACE = %s",
24492450
fmtId(tablespace));
24502451
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