Generate pg_stat_get*() functions for databases using macros
Michael Paquier <michael@paquier.xyz>
Generate pg_stat_get*() functions for databases using macros The same code pattern is repeated 21 times for int64 counters (0 for missing entry) and 5 times for doubles (0 for missing entry) on database entries. This code is switched to use macros for the basic code instead, shaving a few hundred lines of originally-duplicated code patterns. The function names remain the same, but some fields of PgStat_StatDBEntry have to be renamed to cope with the new style. This is in the same spirit as 83a1a1b. Author: Michael Paquier Reviewed-by: Nathan Bossart, Bertrand Drouvot Discussion: https://postgr.es/m/Y46stlxQ2LQE20Na@paquier.xyz
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/activity/pgstat_database.c | modified | +47 −47 |
| src/backend/utils/activity/pgstat_relation.c | modified | +7 −7 |
| src/backend/utils/adt/pgstatfuncs.c | modified | +88 −366 |
| src/include/pgstat.h | modified | +27 −27 |
Discussion
- Generate pg_stat_get_* functions with Macros 22 messages · 2022-11-22 → 2022-12-10