nisha_v44_suggestion.txt

text/plain

Filename: nisha_v44_suggestion.txt
Type: text/plain
Part: 0
Message: Re: Skipping schema changes in publication
diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 17b821fbd71..9fb121d9b0f 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -872,16 +872,16 @@ List *
 GetAllPublicationExceptTables(Oid pubid, PublicationPartOpt pub_partopt)
 {
 	List	   *relids = get_publication_relations(pubid, pub_partopt, true);
-	bool		is_parent_in_except = true;
+	List *new_relids = list_copy(relids);
 
 	Assert(GetPublication(pubid)->alltables);
 
-	while (is_parent_in_except)
+	while (new_relids != NIL)
 	{
 		List	   *parentids = NIL;
 		List	   *curr = NIL;
 
-		foreach_oid(relid, relids)
+		foreach_oid(relid, new_relids)
 		{
 			Oid			parentid;
 
@@ -916,9 +916,8 @@ GetAllPublicationExceptTables(Oid pubid, PublicationPartOpt pub_partopt)
 				curr = lappend_oid(curr, parentid);
 		}
 
-		if (curr == NIL)
-			is_parent_in_except = false;
-		else
+		new_relids = curr;
+		if (curr != NIL)
 			relids = list_concat(relids, curr);
 	}