PS_NITPICKS_20240814_SEQ_0004.txt

text/plain

Filename: PS_NITPICKS_20240814_SEQ_0004.txt
Type: text/plain
Part: 0
Message: Re: Logical Replication of sequences
diff --git a/src/backend/catalog/pg_subscription.c b/src/backend/catalog/pg_subscription.c
index d938e57..af2bfe1 100644
--- a/src/backend/catalog/pg_subscription.c
+++ b/src/backend/catalog/pg_subscription.c
@@ -565,9 +565,11 @@ GetSubscriptionRelations(Oid subid, bool get_tables, bool get_sequences,
 		relkind = get_rel_relkind(subrel->srrelid);
 
 		/* Skip sequences if they were not requested */
-		if ((relkind == RELKIND_SEQUENCE && !get_sequences) ||
-			/* Skip tables if they were not requested */
-			(relkind != RELKIND_SEQUENCE && !get_tables))
+		if (relkind == RELKIND_SEQUENCE && !get_sequences)
+			continue;
+
+		/* Skip tables if they were not requested */
+		if (relkind != RELKIND_SEQUENCE && !get_tables)
 			continue;
 
 		relstate = (SubscriptionRelState *) palloc(sizeof(SubscriptionRelState));
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 4166210..7d0be40 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -2577,9 +2577,9 @@ fetch_sequence_list(WalReceiverConn *wrconn, char *subname, List *publications)
 		 */
 		ereport(WARNING,
 				errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-				errmsg("parameters differ between the remote and local sequences %s for subscription \"%s\"",
+				errmsg("parameters differ for the remote and local sequences (%s) for subscription \"%s\"",
 					   warning_sequences->data, subname),
-				errhint("Alter/Re-create the sequence using the same parameter as in remote."));
+				errhint("Alter/Re-create local sequences to have the same parameters as the remote sequences."));
 		pfree(warning_sequences);
 	}
 
diff --git a/src/backend/replication/logical/sequencesync.c b/src/backend/replication/logical/sequencesync.c
index aaedba9..e2e0421 100644
--- a/src/backend/replication/logical/sequencesync.c
+++ b/src/backend/replication/logical/sequencesync.c
@@ -342,12 +342,12 @@ LogicalRepSyncSequences(void)
 				done_seq = (SubscriptionRelState *) lfirst(list_nth_cell(sequences_not_synced, i));
 
 				ereport(DEBUG1,
-						errmsg("logical replication synchronization for subscription \"%s\", sequence \"%s\" has finished",
+						errmsg_internal("logical replication synchronization for subscription \"%s\", sequence \"%s\" has finished",
 							   get_subscription_name(subid, false), get_rel_name(done_seq->relid)));
 			}
 
 			ereport(LOG,
-					errmsg("logical replication synchronized %d sequences of %d sequences for subscription \"%s\" ",
+					errmsg("logical replication synchronized %d of %d sequences for subscription \"%s\" ",
 						   curr_seq, seq_count, get_subscription_name(subid, false)));
 
 			/* Commit this batch, and prepare for next batch. */
@@ -477,7 +477,7 @@ process_syncing_sequences_for_apply(void)
 		LWLockRelease(LogicalRepWorkerLock);
 
 		/*
-		 * If there are free sync worker slot(s), start a new sequence sync
+		 * If there are free sync worker slot(s), start a new sequencesync
 		 * worker, and break from the loop.
 		 */
 		if (nsyncworkers < max_sync_workers_per_subscription)
diff --git a/src/test/subscription/t/034_sequences.pl b/src/test/subscription/t/034_sequences.pl
index 999561f..38fd7a3 100644
--- a/src/test/subscription/t/034_sequences.pl
+++ b/src/test/subscription/t/034_sequences.pl
@@ -177,7 +177,7 @@ $node_subscriber->safe_psql(
         ALTER SUBSCRIPTION regress_seq_sub REFRESH PUBLICATION SEQUENCES");
 like(
 	$stderr,
-	qr/WARNING: ( [A-Z0-9]+:)? parameters differ between the remote and local sequences "public.regress_s4" for subscription "regress_seq_sub"/,
+	qr/WARNING: ( [A-Z0-9]+:)? parameters differ for the remote and local sequences \("public.regress_s4"\) for subscription "regress_seq_sub"/,
 	"Refresh publication sequences should throw a warning if the sequence definition is not the same"
 );