Re: [Proposal] Adding callback support for custom statistics kinds

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [Proposal] Adding callback support for custom statistics kinds
Date: 2025-12-12 02:58:54
Message-ID: aTuE7kyeDCggXqVf@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 10, 2025 at 12:36:36PM -0600, Sami Imseih wrote:
> .. and after giving this more thought, I actually don't think we should
> do any validation for any of the callbacks. If an extension is writing
> to any file ( core or custom ), naturally they will want to read it back.
> Now I am not sure what these validations are protecting us against.
> Also, maybe the extension wants to just read data from the main stats
> file, I could see that use-case, perhaps.
>
> So, I am proposing removing the validation altogether. What do
> you think?

The to and from callbacks are coupled with each other, so there may be
a point in making sure that if one is defined so is the other. Now, I
have never done any enforcement for the existing from/to serialization
callbacks either because it would be quickly clear for one what needs
to be done when implementing a custom kind. So I'd agree with just
removing these checks and keep the code simpler.

FWIW, I have begun putting my hands on your patch, editing it at some
degree. I am not sure that I will be able to finish that today, but
I'm working towards getting something done.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2025-12-12 02:59:53 Re: enhance wraparound warnings
Previous Message Richard Guo 2025-12-12 02:17:07 Re: Some optimizations for COALESCE expressions during constant folding