Re: log_min_messages per backend type
Euler Taveira <euler@eulerto.com>
From: "Euler Taveira" <euler@eulerto.com>
To: "Alvaro Herrera" <alvherre@alvh.no-ip.org>
Cc: japin <japinli@hotmail.com>, "Andres Freund" <andres@anarazel.de>,
pgsql-hackers@lists.postgresql.org, "Chao Li" <li.evan.chao@gmail.com>
Date: 2026-02-06T15:45:20Z
Lists: pgsql-hackers
Attachments
- v11-0001-log_min_messages-per-process-type.patch (text/x-patch) patch v11-0001
- v11-0002-review.patch (text/x-patch) patch v11-0002
- v11-0003-fixup-review.patch (text/x-patch) patch v11-0003
On Fri, Feb 6, 2026, at 8:05 AM, Alvaro Herrera wrote:
> Here are some fixups for the main patch. I include yours so that CI
> will test this one.
>
All suggestions seem good to me.
> * I'm not fond of the term "generic", so I changed it to "default",
> which IMO makes more sense from the user point of view.
>
I'm fine with "default" instead of "generic". However, you forgot to replace
"generic" in a few places. The attached patch fixes them all.
> * There seemed to be too much guc_mallocking[*] going on; for instance for
> ptype. I simplified that by just overwriting the : to a '\0', then we
> can use the original string for pg_strcasecmp(). At the bottom of the
> loop we restore the ':', so that the code below can reuse the original
> values. This is okay because we have already mallocked a copy for
> SplitGUCList.
>
Nice trick.
> * There's no reason to add a WARNING to every process type in the
> proctypelist.h table. We can just set the values to WARNING in the
> log_min_messages initializer in guc_tables.c.
>
Ok.
> * There's no reason AFAICS to have log_min_messages_process_types in
> guc_tables.c; nobody else uses it. I made it a local array of char*
> inside the check_log_min_messages function.
>
That's true.
> * There's no need to initialize the newlevel[] array, since we're going
> to assign values to every individual element at one point or another.
> And for the assigned[] array, we don't need to set the value of each to
> 'false' in a loop; we can just initialize to '{0}' and the compiler will
> do the needful. With this we can remove the loop entirely.
>
Ok.
> * "guc_free()+list_free()+return false" the whole time in the various
> failure places across the loop was tiresome. I put them all in a single
> place and jump there with a goto.
>
I tend to avoid goto. However, in this case, it seems it improves readability.
> * in foreach() loops, tracking of a 'bool first' is unnecessary. You
> can just compare foreach_current_index() with 0.
>
Didn't know about foreach_current_index.
> * Rewrote docs and comments
>
Ok.
I attached the same patches that you shared plus the s/generic/default/ that I
said earlier for the sake of CI.
--
Euler Taveira
EDB https://www.enterprisedb.com/
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Cleanup for log_min_messages changes in 38e0190ced71
- 1efdd7cc630a 19 (unreleased) landed
-
Allow log_min_messages to be set per process type
- 38e0190ced71 19 (unreleased) landed
-
Assign "backend" type earlier during process start-up
- 0c8e082fba8d 19 (unreleased) landed
-
Use integer backend type when exec'ing a postmaster child
- f1cd34f95272 19 (unreleased) landed
-
Sort guc_parameters.dat alphabetically by name
- fce7c73fba4e 19 (unreleased) cited
-
Create a separate file listing backend types
- dbf8cfb4f02e 19 (unreleased) cited
-
Replace postmaster.c's own backend type codes with BackendType
- 18d67a8d7d30 18.0 cited