Re: Prevent crash when calling pgstat functions with unregistered stats kind

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Ewan Young <kdbase(dot)hack(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Prevent crash when calling pgstat functions with unregistered stats kind
Date: 2026-07-02 05:02:36
Message-ID: akXw7OIRj6L2eU/V@bdtpg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Jul 02, 2026 at 02:00:06PM +0900, Michael Paquier wrote:
> On Thu, Jul 02, 2026 at 04:43:32AM +0000, Bertrand Drouvot wrote:
> > On Thu, Jul 02, 2026 at 04:23:16AM +0000, Bertrand Drouvot wrote:
> >> Ok but what about extensions that don't call pgstat_register_kind() at all? Your
> >> point is that they would see the issue during the development of the extension? (If
> >> so, I think I could agree).
>
> Extensions doing custom stats have to call the register API, or
> they're broken. This is the same assumption as custom RMGRs. There
> are many ways to break the backend if you don't know what you do, just
> take hooks for example. That's just one of them.
>
> > Something like in the attached?
>
> Yes, that looks OK here.

That makes sense, I do agree.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Palak Chaturvedi 2026-07-02 05:06:21 Re: Changing the state of data checksums in a running cluster
Previous Message Michael Paquier 2026-07-02 05:00:06 Re: Prevent crash when calling pgstat functions with unregistered stats kind