On 03/14/2015 05:59 PM, Julien Tachoires wrote:
On 14/03/2015 16:10, Andreas Karlsson wrote:
Noticed a bug when playing round some more with pg_dump. It does not
seem to dump custom table space for the table and default table space
for the toast correctly. It forgets about the toast table being in
pg_default.

Good catch. This is now fixed.

Nice. You will also want to apply the attached patch which fixes support for the --no-tablespaces flag.

--
Andreas Karlsson
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index bc4a0b1..8ef2df9 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -13746,7 +13746,8 @@ dumpTableSchema(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo)
 			destroyPQExpBuffer(result);
 
 			/* Change TOAST tablespace */
-			if (strcmp(tbinfo->reltablespace, tbinfo->reltoasttablespace) != 0)
+			if (!dopt->outputNoTablespaces &&
+				strcmp(tbinfo->reltablespace, tbinfo->reltoasttablespace) != 0)
 			{
 				appendPQExpBuffer(q, "\nALTER MATERIALIZED VIEW %s ",
 					fmtId(tbinfo->dobj.name));
@@ -14032,8 +14033,9 @@ dumpTableSchema(Archive *fout, DumpOptions *dopt, TableInfo *tbinfo)
 	}
 
 	/* Change TOAST tablespace */
-	if (strcmp(tbinfo->reltoasttablespace, tbinfo->reltablespace) != 0 &&
-			tbinfo->relkind == RELKIND_RELATION)
+	if (!dopt->outputNoTablespaces &&
+		strcmp(tbinfo->reltoasttablespace, tbinfo->reltablespace) != 0 &&
+		tbinfo->relkind == RELKIND_RELATION)
 	{
 		appendPQExpBuffer(q, "\nALTER TABLE %s ",
 			fmtId(tbinfo->dobj.name));
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to