1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-22 23:02:54 +03:00

Make pg_upgrade log message with control file path translatable.

Commit 173c97812ff replaced the hardcoded "global/pg_control" in pg_upgrade
log message with a string literal concatenation of XLOG_CONTROL_FILE macro.
However, this change made the message untranslatable.

This commit fixes the issue by using %s with XLOG_CONTROL_FILE instead of
that literal concatenation, allowing the message to be translated properly.
It also wraps the file path in double quotes for consistency with similar
log messages.

Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Masao Fujii <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/20250407.155546.2129693791769531891.horikyota.ntt@gmail.com
This commit is contained in:
Fujii Masao 2025-04-18 18:35:40 +09:00
parent 05883bd6e5
commit 3aad76a0a9

View File

@ -758,7 +758,8 @@ disable_old_cluster(transferMode transfer_mode)
new_path[MAXPGPATH]; new_path[MAXPGPATH];
/* rename pg_control so old server cannot be accidentally started */ /* rename pg_control so old server cannot be accidentally started */
prep_status("Adding \".old\" suffix to old " XLOG_CONTROL_FILE); /* translator: %s is the file path of the control file */
prep_status("Adding \".old\" suffix to old \"%s\"", XLOG_CONTROL_FILE);
snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, XLOG_CONTROL_FILE); snprintf(old_path, sizeof(old_path), "%s/%s", old_cluster.pgdata, XLOG_CONTROL_FILE);
snprintf(new_path, sizeof(new_path), "%s/%s.old", old_cluster.pgdata, XLOG_CONTROL_FILE); snprintf(new_path, sizeof(new_path), "%s/%s.old", old_cluster.pgdata, XLOG_CONTROL_FILE);
@ -768,9 +769,10 @@ disable_old_cluster(transferMode transfer_mode)
check_ok(); check_ok();
if (transfer_mode == TRANSFER_MODE_LINK) if (transfer_mode == TRANSFER_MODE_LINK)
/* translator: %s/%s is the file path of the control file */
pg_log(PG_REPORT, "\n" pg_log(PG_REPORT, "\n"
"If you want to start the old cluster, you will need to remove\n" "If you want to start the old cluster, you will need to remove\n"
"the \".old\" suffix from %s/%s.old.\n" "the \".old\" suffix from \"%s/%s.old\".\n"
"Because \"link\" mode was used, the old cluster cannot be safely\n" "Because \"link\" mode was used, the old cluster cannot be safely\n"
"started once the new cluster has been started.", "started once the new cluster has been started.",
old_cluster.pgdata, XLOG_CONTROL_FILE); old_cluster.pgdata, XLOG_CONTROL_FILE);