Re: [Proposal] Adding callback support for custom statistics kinds - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [Proposal] Adding callback support for custom statistics kinds
Date
Msg-id aTIV8qfcIkht1Hgv@paquier.xyz
Whole thread Raw
In response to Re: [Proposal] Adding callback support for custom statistics kinds  (Sami Imseih <samimseih@gmail.com>)
Responses Re: [Proposal] Adding callback support for custom statistics kinds
List pgsql-hackers
On Thu, Dec 04, 2025 at 05:00:10PM -0600, Sami Imseih wrote:
> Thanks for the input! Yes, this is a trade-off between putting
> responsibility on the
> extension vs core. The initial thought I had was exactly like yours, but it will
> be easier to get something pushed if we make the core changes as minimal as
> possible. If there are enough complaints in the future, this can be revisited.
> Particularly if there is a common patterns for file cleanup, this
> could be turned
> into a core utility.

Another way to shape it would be to have an in-core routine that
provides a default logic for the actions to take depending on the
write, read or discard state, with the state and a FILE* as arguments.
The main pgstats file would call that, modules may decide to use it.

> However, as discussed off-list, I do think moving the custom kind tests from
> injection points to the new test module is a prerequisite. I rather
> not have us push a new test module that is doing duplicate work as the injection
> stats tests.
> I worked on this refactoring today and plan to have a patch ready for review
> by tomorrow.

Cool, thanks!
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Corey Huinker
Date:
Subject: Re: Re: Extended Statistics set/restore/clear functions.
Next
From: Corey Huinker
Date:
Subject: Re: vacuumdb: add --dry-run