From 331a3b37b1141adeb3b9d565e120e7a42d2db903 Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Tue, 2 Dec 2025 19:26:55 +0900 Subject: [PATCH] Fix memqcache_stats_start_time shown in "show pool_status". get_config() uses ctime() to generate printable form of memqcache_stats_start_time. But it did not take into account that ctime() adds newline at the end of result. As a result, not only the output of memqcache_stats_start_time was with unnecessary newline but next row printed empty items. Author: Tatsuo Ishii Discussion: https://www.postgresql.org/message-id/20251130.102712.131456481338876013.ishii%40postgresql.org Backpatch-through: v4.3 --- src/utils/pool_process_reporting.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/pool_process_reporting.c b/src/utils/pool_process_reporting.c index e4fcf4457..9e677d95e 100644 --- a/src/utils/pool_process_reporting.c +++ b/src/utils/pool_process_reporting.c @@ -1117,6 +1117,8 @@ get_config(int *nrows) StrNCpy(status[i].name, "memqcache_stats_start_time", POOLCONFIG_MAXNAMELEN); snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%s", ctime(&pool_get_memqcache_stats()->start_time)); + /* remove a newline added by ctime() */ + *(strchrnul(status[i].value, '\n')) = '\0'; StrNCpy(status[i].desc, "Start time of query cache stats", POOLCONFIG_MAXDESCLEN); i++; -- 2.39.5