diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c index b2ca3f39b7..612158f2b9 100644 --- a/src/backend/utils/activity/pgstat.c +++ b/src/backend/utils/activity/pgstat.c @@ -1781,6 +1781,12 @@ pgstat_read_statsfile(XLogRecPtr redo) } info = pgstat_get_kind_info(kind); + if (!info) + { + elog(WARNING, "could not find information of kind %u for entry of type %c", + kind, t); + goto error; + } if (!info->fixed_amount) { @@ -1861,6 +1867,12 @@ pgstat_read_statsfile(XLogRecPtr redo) } kind_info = pgstat_get_kind_info(kind); + if (!kind_info) + { + elog(WARNING, "could not find information of kind %u for entry of type %c", + kind, t); + goto error; + } if (!kind_info->from_serialized_name) { diff --git a/src/test/modules/injection_points/t/001_stats.pl b/src/test/modules/injection_points/t/001_stats.pl index 7d6070e713..36728f16fc 100644 --- a/src/test/modules/injection_points/t/001_stats.pl +++ b/src/test/modules/injection_points/t/001_stats.pl @@ -69,4 +69,10 @@ $fixedstats = $node->safe_psql('postgres', "SELECT * FROM injection_points_stats_fixed();"); is($fixedstats, '0|0|0|0|0', 'fixed stats after crash'); +# Stop the server, disable the module, then restart. The server +# should be able to come up. +$node->stop; +$node->adjust_conf('postgresql.conf', 'shared_preload_libraries', "''"); +$node->start; + done_testing();