Subject: Fix the error hint message and test for reset_shared with unknown stats type

From: Maksim Logvinenko <[email-masked]>
Date: Tue, 28 Apr 2026 20:13:11 +0500

Hi hackers,

The errhint() in pg_stat_reset_shared() were missing the fact that recently added in [1] new lock stats kind.

The patch fixes error hint message and regress test for reset_shared with unknown stats type.

[1]: https://www.postgresql.org/message-id/aIyNxBWFCybgBZBS%40ip-10-97-1-34.eu-west-3.compute.internal

Best regards,

Maksim Logvinenko

Postgres Professional: http://postgrespro.com

---

From: Maksim Logvinenko <[email-masked]>
Date: Tue, 28 Apr 2026 20:18:21 +0500

I'm sorry for the forgotten patch in the attachment

----------------

Кому: [email-masked] ([email-masked]);

Тема: Fix the error hint message and test for reset_shared with unknown stats type;

28.04.2026, 20:13, "Maksim Logvinenko" <[email-masked]>:

Hi hackers,

Best regards,

Maksim Logvinenko

From 70146d0c7fe4438687fb5469c60b4febbf40cac0 Mon Sep 17 00:00:00 2001
From: Maksim Logvinenko <[email-masked]>
Date: Tue, 28 Apr 2026 20:06:45 +0500
Subject: [PATCH] Fix the error hint message and test for reset_shared with
 unknown stats type.

The existing error hint message and test were missing the fact that
recently added new lock stats kind.
---
 src/backend/utils/adt/pgstatfuncs.c | 2 +-
 src/test/regress/expected/stats.out | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index 1408de387ea..7a9dfa9ba3b 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -1987,7 +1987,7 @@ pg_stat_reset_shared(PG_FUNCTION_ARGS)
 		ereport(ERROR,
 				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 				 errmsg("unrecognized reset target: \"%s\"", target),
-				 errhint("Target must be \"archiver\", \"bgwriter\", \"checkpointer\", \"io\", \"recovery_prefetch\", \"slru\", or \"wal\".")));
+				 errhint("Target must be \"archiver\", \"bgwriter\", \"checkpointer\", \"io\", \"lock\", \"recovery_prefetch\", \"slru\", or \"wal\".")));
 
 	PG_RETURN_VOID();
 }
diff --git a/src/test/regress/expected/stats.out b/src/test/regress/expected/stats.out
index e5dcb85abd8..c551abb1178 100644
--- a/src/test/regress/expected/stats.out
+++ b/src/test/regress/expected/stats.out
@@ -1164,7 +1164,7 @@ SELECT stats_reset > :'wal_reset_ts'::timestamptz FROM pg_stat_wal;
 -- Test error case for reset_shared with unknown stats type
 SELECT pg_stat_reset_shared('unknown');
 ERROR:  unrecognized reset target: "unknown"
-HINT:  Target must be "archiver", "bgwriter", "checkpointer", "io", "recovery_prefetch", "slru", or "wal".
+HINT:  Target must be "archiver", "bgwriter", "checkpointer", "io", "lock", "recovery_prefetch", "slru", or "wal".
 -- Test that reset works for pg_stat_database and pg_stat_database_conflicts
 -- Since pg_stat_database stats_reset starts out as NULL, reset it once first so that we
 -- have a baseline for comparison. The same for pg_stat_database_conflicts as it shares
-- 
2.43.0

---

From: Michael Paquier <[email-masked]>
Date: Wed, 29 Apr 2026 08:12:04 +0900

> +				 errhint("Target must be \"archiver\", \"bgwriter\", \"checkpointer\", \"io\", \"lock\", \"recovery_prefetch\", \"slru\", or \"wal\".")));

Right, thanks for the report, Maksim.  I'll fix it later.
--
Michael

---

From: Michael Paquier <[email-masked]>
Date: Thu, 30 Apr 2026 11:33:35 +0900

> Right, thanks for the report, Maksim.  I'll fix it later.

And done.
--
Michael