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-01-15T13:50:00Z
Lists: pgsql-hackers
On Tue, Dec 9, 2025, at 1:30 PM, Alvaro Herrera wrote:
> BTW another thing I realized while looking this over, is that we quite
> uselessly transform the integer backend type to a string, pass it as a
> string using the --forkchild= argument to the child process, then parse
> the string back to an int to use as an array index.  It would be much
> easier to just use the integer value everywhere, as the attached shows.
>

It is a good simplification. There is just one oversight.

+   child_type = (BackendType) atoi(child_kind);
+   if (child_type <= B_INVALID || child_type > BACKEND_NUM_TYPES)
        elog(ERROR, "unknown child kind %s", child_kind);

It should be BACKEND_NUM_TYPES - 1.


-- 
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 →
  1. Cleanup for log_min_messages changes in 38e0190ced71

  2. Allow log_min_messages to be set per process type

  3. Assign "backend" type earlier during process start-up

  4. Use integer backend type when exec'ing a postmaster child

  5. Sort guc_parameters.dat alphabetically by name

  6. Create a separate file listing backend types

  7. Replace postmaster.c's own backend type codes with BackendType