Re: pgstat include expansion

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)kurilemu(dot)de>
Subject: Re: pgstat include expansion
Date: 2026-02-16 04:36:02
Message-ID: aZKesltb6Z35hlbP@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 13, 2026 at 05:14:01PM -0500, Andres Freund wrote:
> I think now that we rely on C11, we actually could also forward-declare enum
> typedefs. That would allow us to avoid including
> worker_internal.h. Unfortunately I think C++ might throw a wrench in the mix
> for that - IIUC it only allows forward declaring enums when using 'enum
> class', but I don't think we can rely on that. I think the best solution
> would be to move the typedef to a more suitable header, but baring that, I
> guess just passing an int would do.

> -extern void pgstat_report_subscription_error(Oid subid,
> - LogicalRepWorkerType wtype);
> +extern void pgstat_report_subscription_error(Oid subid, int wtype);

FWIW, I like some type enforcements when it comes to such report
routines. That avoids some careless assignments. This is usually a
sign of header refactoring to me, where the "light" declarations ought
to be moved into an independent header that can be fed back to other
places, like this one. An enum declaration or a set of constants can
be usually worth a split if their knowledge gets a lot across the
tree. That's just to say that while I agree about reducing the header
footprint, I don't find the result presented here to be the best thing
we can do.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2026-02-16 04:36:58 Re: Skipping schema changes in publication
Previous Message Thomas Munro 2026-02-16 04:35:41 Re: Questionable description about character sets