PS_use_GetPublicationsStr.txt

text/plain

Filename: PS_use_GetPublicationsStr.txt
Type: text/plain
Part: 0
Message: Re: Skipping schema changes in publication
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0ecf835ffaa..b1ed780c55a 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -50,6 +50,7 @@
 #include "catalog/pg_publication_rel.h"
 #include "catalog/pg_rewrite.h"
 #include "catalog/pg_statistic_ext.h"
+#include "catalog/pg_subscription.h"
 #include "catalog/pg_tablespace.h"
 #include "catalog/pg_trigger.h"
 #include "catalog/pg_type.h"
@@ -20699,28 +20700,15 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd,
 	exceptpuboids = GetRelationExcludedPublications(RelationGetRelid(attachrel));
 	if (exceptpuboids != NIL)
 	{
-		bool		first = true;
+		List *pubs = NIL;
 		StringInfoData pubnames;
 
-		initStringInfo(&pubnames);
-
 		foreach_oid(pubid, exceptpuboids)
-		{
-			char	   *pubname = get_publication_name(pubid, false);
-
-			if (!first)
-			{
-				/*
-				 * translator: This is a separator in a list of publication
-				 * names.
-				 */
-				appendStringInfoString(&pubnames, _(", "));
-			}
+			pubs = lappend(pubs, makeString(get_publication_name(pubid, false)));
 
-			first = false;
+		initStringInfo(&pubnames);
 
-			appendStringInfo(&pubnames, _("\"%s\""), pubname);
-		}
+		GetPublicationsStr(pubs, &pubnames, false);
 
 		ereport(ERROR,
 				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),