Re: Prevent crash when calling pgstat functions with unregistered stats kind - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Prevent crash when calling pgstat functions with unregistered stats kind
Date
Msg-id akXalpb3zjPX3ZEl@bdtpg
Whole thread
In response to Re: Prevent crash when calling pgstat functions with unregistered stats kind  (Ewan Young <kdbase.hack@gmail.com>)
Responses Re: Prevent crash when calling pgstat functions with unregistered stats kind
List pgsql-hackers
Hi Ewan,

On Wed, Jul 01, 2026 at 04:20:39PM +0800, Ewan Young wrote:
> Thanks for the patch — nice catch, and the diagnosis looks right.

Thanks for looking at it!

> One small thing: in pgstat_snapshot_fixed(), the existing
> Assert(pgstat_is_kind_valid(kind)); becomes redundant after the new NULL
> check. A non-NULL kind_info already implies the kind is valid (that's the
> only way pgstat_get_kind_info() returns non-NULL), so the assert can never
> fire. Might as well drop it and keep just the fixed_amount one.

Yeah good catch, done in the attached.

Regards,

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

Attachment

pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: Re: implement CAST(expr AS type FORMAT 'template')
Next
From: "zengman"
Date:
Subject: Re: (SQL/PGQ) Clean up orphaned properties when dropping a label