Skip to content

Fix build due to changes in PostgreSQL 16 #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions collector.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);
}
Expand Down
15 changes: 15 additions & 0 deletions compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
4 changes: 1 addition & 3 deletions pg_wait_sampling.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down Expand Up @@ -452,7 +451,6 @@ pg_wait_sampling_get_current(PG_FUNCTION_ARGS)
{
MemoryContext oldcontext;
TupleDesc tupdesc;
WaitCurrentContext *params;

funcctx = SRF_FIRSTCALL_INIT();

Expand Down