pg_createsubscriber --dry-run logging concerns
Peter Smith <smithpb2250@gmail.com>
From: Peter Smith <smithpb2250@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-10-01T02:29:56Z
Lists: pgsql-hackers
Lately, I've been reviewing some pg_createsubscriber patches and have
been tricked by some of the logging.
The pg_createsubscriber has a '--dry-run' option/mode [1]
----------
--dry-run
Do everything except actually modifying the target directory.
----------
I've noticed that the logging in '--dry-run' mode is indistinguishable
from the logging of "normal" run, although functions like
create_publication(), drop_publication(), etc, are NOP in '--dry-run'
mode, because the actual command execution code is skipped. e.g.
if (!dry_run)
{
res = PQexec(conn, str->data);
...
}
~~~
IMO, it's not good to fool people into thinking something has happened
when in fact nothing happened at all. I think the logging of this tool
should be much more explicit wrt when it is/isn't in dry-run mode.
Perhaps like this:
NORMAL
pg_log_info("creating publication \"%s\" in database \"%s\"", ...)
DRY-RUN
pg_log_info("[dry-run] would create publication \"%s\" in database \"%s\"", ...)
~~~
Thoughts?
======
[1] https://www.postgresql.org/docs/current/app-pgcreatesubscriber.html
Kind Regards,
Peter Smith.
Fujitsu Australia
Commits
-
Split dry-run messages into primary and detail
- 36b1a1e826ea 19 (unreleased) landed
- e3b5817c8b89 master landed
-
Log a note at program start when running in dry-run mode
- c05dee191125 19 (unreleased) landed
-
Use USECS_PER_SEC from datatype/timestamp.h
- ad1581d7feae 19 (unreleased) landed
-
Remove WaitPMResult enum in pg_createsubscriber
- f242dbcede9c 19 (unreleased) landed
-
pg_createsubscriber: reword dry-run log messages
- c25314d5364e 18.1 landed
- 2648eab3779b 19 (unreleased) landed