From 5a4eba558aa76c36ecf2aab7587b233c0e2003e2 Mon Sep 17 00:00:00 2001 From: Amit Kapila Date: Thu, 6 Nov 2025 08:52:31 +0000 Subject: Fix few issues in commit 5509055d69. Test failure on buildfarm member prion: The test failed due to an unexpected LOCATION: line appearing between the WARNING and ERROR messages. This occurred because the prion machine uses log_error_verbosity = verbose, which includes additional context in error messages. The test was originally checking for both WARNING and ERROR messages in sequence sync, but the extra LOCATION: line disrupted this pattern. To make the test robust across different verbosity settings, it now only checks for the presence of the WARNING message after the test, which is sufficient to validate the intended behavior. Failure to sync sequences with quoted names: The previous implementation did not correctly quote sequence names when querying remote information, leading to failures when quoted sequence names were used. This fix ensures that sequence names are properly quoted during remote queries, allowing sequences with quoted identifiers to be synced correctly. Author: Vignesh C Author: Shinya Kato Reviewed-by: Amit Kapila Discussion: https://postgr.es/m/CALDaNm0WcdSCoNPiE-5ek4J2dMJ5o111GPTzKCYj9G5i=ONYtQ@mail.gmail.com Discussion: https://postgr.es/m/CAOzEurQOSN=Zcp9uVnatNbAy=2WgMTJn_DYszYjv0KUeQX_e_A@mail.gmail.com --- src/backend/replication/logical/sequencesync.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/backend/replication') diff --git a/src/backend/replication/logical/sequencesync.c b/src/backend/replication/logical/sequencesync.c index 717c82328f2..a8a39bec508 100644 --- a/src/backend/replication/logical/sequencesync.c +++ b/src/backend/replication/logical/sequencesync.c @@ -60,6 +60,7 @@ #include "replication/logicalworker.h" #include "replication/worker_internal.h" #include "utils/acl.h" +#include "utils/builtins.h" #include "utils/fmgroids.h" #include "utils/guc.h" #include "utils/inval.h" @@ -407,14 +408,20 @@ copy_sequences(WalReceiverConn *conn) for (int idx = cur_batch_base_index; idx < n_seqinfos; idx++) { + char *nspname_literal; + char *seqname_literal; + LogicalRepSequenceInfo *seqinfo = (LogicalRepSequenceInfo *) list_nth(seqinfos, idx); if (seqstr->len > 0) appendStringInfoString(seqstr, ", "); - appendStringInfo(seqstr, "(\'%s\', \'%s\', %d)", - seqinfo->nspname, seqinfo->seqname, idx); + nspname_literal = quote_literal_cstr(seqinfo->nspname); + seqname_literal = quote_literal_cstr(seqinfo->seqname); + + appendStringInfo(seqstr, "(%s, %s, %d)", + nspname_literal, seqname_literal, idx); if (++batch_size == MAX_SEQUENCES_SYNC_PER_BATCH) break; -- cgit v1.2.3