Concerns regarding code in pgstat_backend.c

From: "Ryo Matsumura (Fujitsu)" <matsumura(dot)ryo(at)fujitsu(dot)com>
To: "michael(at)paquier(dot)xyz" <michael(at)paquier(dot)xyz>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Concerns regarding code in pgstat_backend.c
Date: 2026-02-06 07:11:07
Message-ID: TYCPR01MB11316AD8150C8F470319ACCAEE866A@TYCPR01MB11316.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, Michael and Hackers,

I found the code that is likely to cause bugs in the future. It's not currently a bug.
Should I have misunderstood, please feel free to disregard this email.

pgstat_create_backend(ProcNumber procnum) uses MyProcNumber instead of the argument.
I've had a quick look through the commit log and thread, but I don't seem to have found the reason.
Wouldn't it be better to use 'procnum'?

This change seems to have appeared in v2-0002-More-work-to-allow-backend-statistics-in-critical.patch on 2025-01-20 06:34:41
https://www.postgresql.org/message-id/flat/66efowskppsns35v5u2m7k4sdnl7yoz5bo64tdjwq7r5lhplrz%40y7dme5xwh2r5#fba8e490848df1798e7c693c70a43f56

Best Regards
Ryo Matsumura

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-02-06 07:11:38 Re: Add expressions to pg_restore_extended_stats()
Previous Message Andrey Borodin 2026-02-06 07:02:35 Windows locales and tests portability