diff options
| author | Masahiko Sawada <msawada@postgresql.org> | 2025-10-14 11:45:29 -0700 |
|---|---|---|
| committer | Masahiko Sawada <msawada@postgresql.org> | 2025-10-14 11:45:29 -0700 |
| commit | 74ac377d75135e02064fc4427bec401277b4f60c (patch) | |
| tree | 371d1ea275c9aec150864378b1840ec70e355334 | |
| parent | 8efe982fe2c5b900554d489c0409618638193aef (diff) | |
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
| -rw-r--r-- | src/bin/pg_basebackup/pg_createsubscriber.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c index d29407413d9..b33566eabac 100644 --- a/src/bin/pg_basebackup/pg_createsubscriber.c +++ b/src/bin/pg_basebackup/pg_createsubscriber.c @@ -1755,10 +1755,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); } |
