agora inbox for [email protected]help / color / mirror / Atom feed
[PATCH v4 2/3] remove lo_hton64() and lo_ntoh64() 266+ messages / 2 participants [nested] [flat]
* [PATCH v4 2/3] remove lo_hton64() and lo_ntoh64() @ 2026-06-02 17:22 Reviewer <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Reviewer @ 2026-06-02 17:22 UTC (permalink / raw) --- src/interfaces/libpq/fe-lobj.c | 58 +++------------------------------- 1 file changed, 4 insertions(+), 54 deletions(-) diff --git a/src/interfaces/libpq/fe-lobj.c b/src/interfaces/libpq/fe-lobj.c index 1660c969f58..42b2a36bda9 100644 --- a/src/interfaces/libpq/fe-lobj.c +++ b/src/interfaces/libpq/fe-lobj.c @@ -43,8 +43,6 @@ static int lo_initialize(PGconn *conn); static Oid lo_import_internal(PGconn *conn, const char *filename, Oid oid); -static int64_t lo_hton64(int64_t host64); -static int64_t lo_ntoh64(int64_t net64); /* * lo_open @@ -213,7 +211,7 @@ lo_truncate64(PGconn *conn, int fd, int64_t len) argv[0].len = 4; argv[0].u.integer = fd; - len = lo_hton64(len); + len = pg_hton64(len); argv[1].isint = 0; argv[1].len = 8; argv[1].u.ptr = (int *) &len; @@ -403,7 +401,7 @@ lo_lseek64(PGconn *conn, int fd, int64_t offset, int whence) argv[0].len = 4; argv[0].u.integer = fd; - offset = lo_hton64(offset); + offset = pg_hton64(offset); argv[1].isint = 0; argv[1].len = 8; argv[1].u.ptr = (int *) &offset; @@ -417,7 +415,7 @@ lo_lseek64(PGconn *conn, int fd, int64_t offset, int whence) if (PQresultStatus(res) == PGRES_COMMAND_OK && result_len == 8) { PQclear(res); - return lo_ntoh64(retval); + return pg_ntoh64(retval); } else { @@ -571,7 +569,7 @@ lo_tell64(PGconn *conn, int fd) if (PQresultStatus(res) == PGRES_COMMAND_OK && result_len == 8) { PQclear(res); - return lo_ntoh64(retval); + return pg_ntoh64(retval); } else { @@ -1014,51 +1012,3 @@ lo_initialize(PGconn *conn) conn->lobjfuncs = lobjfuncs; return 0; } - -/* - * lo_hton64 - * converts a 64-bit integer from host byte order to network byte order - */ -static int64_t -lo_hton64(int64_t host64) -{ - union - { - int64 i64; - uint32 i32[2]; - } swap; - uint32 t; - - /* High order half first, since we're doing MSB-first */ - t = (uint32) (host64 >> 32); - swap.i32[0] = pg_hton32(t); - - /* Now the low order half */ - t = (uint32) host64; - swap.i32[1] = pg_hton32(t); - - return swap.i64; -} - -/* - * lo_ntoh64 - * converts a 64-bit integer from network byte order to host byte order - */ -static int64_t -lo_ntoh64(int64_t net64) -{ - union - { - int64 i64; - uint32 i32[2]; - } swap; - int64 result; - - swap.i64 = net64; - - result = (uint32) pg_ntoh32(swap.i32[0]); - result <<= 32; - result |= (uint32) pg_ntoh32(swap.i32[1]); - - return result; -} -- 2.50.1 (Apple Git-155) --Z10p9YYojB0/BzD2 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=v4-0003-add-helper-functions-for-fast-path-arg-setup.patch ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
* [PATCH v3] Fix test_custom_stats modules to error out when not preloaded @ 2026-07-02 04:34 Bertrand Drouvot <[email protected]> 0 siblings, 0 replies; 266+ messages in thread From: Bertrand Drouvot @ 2026-07-02 04:34 UTC (permalink / raw) Previously, test_custom_var_stats and test_custom_fixed_stats silently skipped pgstat_register_kind() when not loaded via shared_preload_libraries. This left the SQL functions callable without the kind registered, leading to NULL dereferences in core pgstat functions. Remove the early return and let pgstat_register_kind() error out naturally, matching the pattern used by test_custom_rmgrs with RegisterCustomRmgr(). Now CREATE EXTENSION fails with a clear error if the module is not preloaded. Author: Bertrand Drouvot <[email protected]> Reviewed-by: Ewan Young <[email protected]> Discussion: https://postgr.es/m/akS/ldidWeqG1FWk%40bdtpg --- .../modules/test_custom_stats/test_custom_fixed_stats.c | 9 ++++----- .../modules/test_custom_stats/test_custom_var_stats.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) 100.0% src/test/modules/test_custom_stats/ diff --git a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c index a066ce117a6..8b29ca3e27a 100644 --- a/src/test/modules/test_custom_stats/test_custom_fixed_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_fixed_stats.c @@ -72,11 +72,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_FIXED_STATS, &custom_stats); } diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index 863d6a52492..fa415c81301 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -129,11 +129,10 @@ static const PgStat_KindInfo custom_stats = { void _PG_init(void) { - /* Must be loaded via shared_preload_libraries */ - if (!process_shared_preload_libraries_in_progress) - return; - - /* Register custom statistics kind */ + /* + * In order to register our custom statistics kind, we have to be loaded + * via shared_preload_libraries. Otherwise, registration will fail. + */ pgstat_register_kind(PGSTAT_KIND_TEST_CUSTOM_VAR_STATS, &custom_stats); } -- 2.34.1 --i51FQWZELabmlh2Y-- ^ permalink raw reply [nested|flat] 266+ messages in thread
end of thread, other threads:[~2026-07-02 04:34 UTC | newest] Thread overview: 266+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-06-02 17:22 [PATCH v4 2/3] remove lo_hton64() and lo_ntoh64() Reviewer <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]> 2026-07-02 04:34 [PATCH v3] Fix test_custom_stats modules to error out when not preloaded Bertrand Drouvot <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox