no-tablespaces.patch

text/x-patch

Filename: no-tablespaces.patch
Type: text/x-patch
Part: 0
Message: Re: patch : Allow toast tables to be moved to a different tablespace

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/bin/pg_dump/pg_dump.c 5 3
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));