1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-19 15:49:24 +03:00

pg_createsubscriber: Add log message when no publications exist to drop.

When specifying --clean=publication to pg_createsubscriber, it drops
all existing publications with a log message "dropping all existing
publications in database "testdb"". Add a new log message "no
publications found" when there are no publications to drop, making the
progress more transparent to users.

Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CAHut+Ptm+WJwbbYXhC0s6FP_98KzZCR=5CPu8F8N5uV8P7BpqA@mail.gmail.com
This commit is contained in:
Masahiko Sawada
2025-10-14 11:45:29 -07:00
parent 8efe982fe2
commit 74ac377d75

View File

@@ -1755,10 +1755,15 @@ check_and_drop_publications(PGconn *conn, struct LogicalRepInfo *dbinfo)
disconnect_database(conn, true); disconnect_database(conn, true);
} }
/* Drop each publication */ if (PQntuples(res) > 0)
for (int i = 0; i < PQntuples(res); i++) {
drop_publication(conn, PQgetvalue(res, i, 0), dbinfo->dbname, /* Drop each publication */
&dbinfo->made_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); PQclear(res);
} }