From f33e60a53a9ca89b5078df49416acae20affe1f5 Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Wed, 22 Oct 2025 20:09:43 +0900 Subject: Make invalid primary_slot_name follow standard GUC error reporting. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, if primary_slot_name was set to an invalid slot name and the configuration file was reloaded, both the postmaster and all other backend processes reported a WARNING. With many processes running, this could produce a flood of duplicate messages. The problem was that the GUC check hook for primary_slot_name reported errors at WARNING level via ereport(). This commit changes the check hook to use GUC_check_errdetail() and GUC_check_errhint() for error reporting. As with other GUC parameters, this causes non-postmaster processes to log the message at DEBUG3, so by default, only the postmaster's message appears in the log file. Backpatch to all supported versions. Author: Fujii Masao Reviewed-by: Chao Li Reviewed-by: Amit Kapila Reviewed-by: Álvaro Herrera Reviewed-by: Hayato Kuroda Discussion: https://postgr.es/m/CAHGQGwFud-cvthCTfusBfKHBS6Jj6kdAPTdLWKvP2qjUX6L_wA@mail.gmail.com Backpatch-through: 13 --- src/include/replication/slot.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/include') diff --git a/src/include/replication/slot.h b/src/include/replication/slot.h index fe62162cde3..09c69f83d57 100644 --- a/src/include/replication/slot.h +++ b/src/include/replication/slot.h @@ -321,6 +321,9 @@ extern void ReplicationSlotInitialize(void); extern bool ReplicationSlotValidateName(const char *name, bool allow_reserved_name, int elevel); +extern bool ReplicationSlotValidateNameInternal(const char *name, + bool allow_reserved_name, + int *err_code, char **err_msg, char **err_hint); extern void ReplicationSlotReserveWal(void); extern void ReplicationSlotsComputeRequiredXmin(bool already_locked); extern void ReplicationSlotsComputeRequiredLSN(void); -- cgit v1.2.3