test_custom_stats: Fail if loading module outside shared_preload_libraries
Michael Paquier <michael@paquier.xyz>
test_custom_stats: Fail if loading module outside shared_preload_libraries Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries, behavior inherited from injection_points. This left the SQL functions callable without the kind registered, leading to various issues on the backend side. This code is not designed to work without the pgstats kinds registered. pgstat_register_kind() gets now called when these libraries are loaded, with or without shared_preload_libraries, letting the registration fail if loading the modules at a later step than startup. test_custom_rmgrs does the same thing. Oversight in 31280d96a648. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Reviewed-by: Ewan Young <kdbase.hack@gmail.com> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk@bdtpg Backpatch-through: 19
Files
| Path | Change | +/− |
|---|---|---|
| src/test/modules/test_custom_stats/test_custom_fixed_stats.c | modified | +0 −4 |
| src/test/modules/test_custom_stats/test_custom_var_stats.c | modified | +0 −4 |
Discussion
- Prevent crash when calling pgstat functions with unregistered stats kind 11 messages · 2026-07-01 → 2026-07-02