public inbox for [email protected]  
help / color / mirror / Atom feed
From: Euler Taveira <[email protected]>
To: Chao Li <[email protected]>
To: Alvaro Herrera <[email protected]>
Cc: japin <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: [email protected]
Subject: Re: log_min_messages per backend type
Date: Wed, 10 Dec 2025 22:57:51 -0300
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>

On Tue, Dec 9, 2025, at 11:00 PM, Chao Li wrote:
> Now “show log_min_messages” prints the raw string the user set, in 
> above example, there is not a white-space between the two log levels, 
> and “show” result doesn’t have a white-space between the two log levels 
> either. IMO, “SHOW log_min_messages” should display a stable result, in 
> other words, say “fatal, backend:log” and “backend:log, fatal” should 
> show the same result as they are actually meaning the same. So, I would 
> suggest normalize the raw string: put the general level in the first 
> place and sort others by process type, then SHOW returns the normalized 
> string.
>

I thought about it but leave it alone because (a) it would increase this patch
footprint and (b) the input might be different from the output. I could also be
done in another patch but under reflection an unstable output can break tests
or whatever uses the SHOW log_min_messages output. I thought this change would
require a new show_log_min_messages to manipulate the input again but we can
reassign the GUC value after sorting the existing list and creating a new string
list.

> In the “if” and “else” clauses, there are duplicate code to valid log 
> levels. We should refactor the code to avoid the duplication. For 
> example, pull up “loglevel” to the “for” loop level, then we can valid 
> it after the “if-else”.
>

The for loop is duplicate but if you create a separate function for it but the
result is:

 src/backend/commands/variable.c | 43 ++++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 21 deletions(-)


I'll post a patch in a couple of hours after spend more time in it.


-- 
Euler Taveira
EDB   https://www.enterprisedb.com/





view thread (20+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: log_min_messages per backend type
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox