From 28216c56a4ceae62c161393150ff27c89aaac64d Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Thu, 9 Oct 2025 12:29:06 +1100
Subject: [PATCH v1] say if there are no pubs to drop

---
 src/bin/pg_basebackup/pg_createsubscriber.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c
index 3986882..b6a0f13 100644
--- a/src/bin/pg_basebackup/pg_createsubscriber.c
+++ b/src/bin/pg_basebackup/pg_createsubscriber.c
@@ -1758,10 +1758,15 @@ check_and_drop_publications(PGconn *conn, struct LogicalRepInfo *dbinfo)
 			disconnect_database(conn, true);
 		}
 
-		/* Drop each publication */
-		for (int i = 0; i < PQntuples(res); i++)
-			drop_publication(conn, PQgetvalue(res, i, 0), dbinfo->dbname,
-							 &dbinfo->made_publication);
+		if (PQntuples(res) > 0)
+		{
+			/* Drop each publication */
+			for (int i = 0; i < PQntuples(res); i++)
+				drop_publication(conn, PQgetvalue(res, i, 0), dbinfo->dbname,
+								 &dbinfo->made_publication);
+		}
+		else
+			pg_log_info("no publications found");
 
 		PQclear(res);
 	}
-- 
1.8.3.1

