diff --git a/collector.c b/collector.c index e1e00cf..dcb9695 100644 --- a/collector.c +++ b/collector.c @@ -470,7 +470,7 @@ pgws_collector_main(Datum main_arg) send_profile(profile_hash, mqh); break; default: - AssertState(false); + Assert(false); } break; case SHM_MQ_DETACHED: @@ -480,7 +480,7 @@ pgws_collector_main(Datum main_arg) "detached"))); break; default: - AssertState(false); + Assert(false); } shm_mq_detach_compat(mqh, pgws_collector_mq); } diff --git a/compat.h b/compat.h index 3f471ce..32874f7 100644 --- a/compat.h +++ b/compat.h @@ -15,6 +15,7 @@ #include "access/tupdesc.h" #include "miscadmin.h" #include "storage/shm_mq.h" +#include "utils/guc_tables.h" static inline TupleDesc CreateTemplateTupleDescCompat(int nattrs, bool hasoid) @@ -65,4 +66,18 @@ InitPostgresCompat(const char *in_dbname, Oid dboid, #endif } +static inline void +get_guc_variables_compat(struct config_generic ***vars, int *num_vars) +{ + Assert(vars != NULL); + Assert(num_vars != NULL); + +#if PG_VERSION_NUM >= 160000 + *vars = get_guc_variables(num_vars); +#else + *vars = get_guc_variables(); + *num_vars = GetNumConfigOptions(); +#endif +} + #endif diff --git a/pg_wait_sampling.c b/pg_wait_sampling.c index 8017a6f..eaa0327 100644 --- a/pg_wait_sampling.c +++ b/pg_wait_sampling.c @@ -198,8 +198,7 @@ setup_gucs() profile_pid_found = false, profile_queries_found = false; - guc_vars = get_guc_variables(); - numOpts = GetNumConfigOptions(); + get_guc_variables_compat(&guc_vars, &numOpts); for (i = 0; i < numOpts; i++) { @@ -452,7 +451,6 @@ pg_wait_sampling_get_current(PG_FUNCTION_ARGS) { MemoryContext oldcontext; TupleDesc tupdesc; - WaitCurrentContext *params; funcctx = SRF_FIRSTCALL_INIT();