Some refactoring for fixed-numbered stats template in injection_points

Started by Michael Paquierabout 2 years ago1 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t50130
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 27, 2026 at 11:43 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t50130_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t50130_1 && git checkout t50130_1

Patchset v1 (message #1) is on t50130_1

Jump to latest
#1Michael Paquier
michael@paquier.xyz

Hi all,

While reading again the code of injection_stats_fixed.c that holds the
template for fixed-numbered pgstats, I got an idea to make the code a
bit more elegant. Rather than using a single routine to increment the
counters, we could use a series of routines with its internals hidden
in a macro like in pgstatfuncs.c.

The point of a template is to be as elegant as possible, and this
is arguably a better style, still this comes down to personal taste
perhaps. Please feel free to comment about the attached.

Thanks,
--
Michael

Attachments:

t50130_1
0001-injection_points-Make-template-for-fixed-numbered-st.patchtext/x-diff; charset=us-asciiDownload+40-36