Skip to content

Commit 544a4ee

Browse files
Merge pull request #64 from postgrespro/PGPRO-7444
Fix build due to changes in PostgreSQL 16
2 parents 1ff4426 + 9526428 commit 544a4ee

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

Diff for: collector.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ pgws_collector_main(Datum main_arg)
470470
send_profile(profile_hash, mqh);
471471
break;
472472
default:
473-
AssertState(false);
473+
Assert(false);
474474
}
475475
break;
476476
case SHM_MQ_DETACHED:
@@ -480,7 +480,7 @@ pgws_collector_main(Datum main_arg)
480480
"detached")));
481481
break;
482482
default:
483-
AssertState(false);
483+
Assert(false);
484484
}
485485
shm_mq_detach_compat(mqh, pgws_collector_mq);
486486
}

Diff for: compat.h

+15
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "access/tupdesc.h"
1616
#include "miscadmin.h"
1717
#include "storage/shm_mq.h"
18+
#include "utils/guc_tables.h"
1819

1920
static inline TupleDesc
2021
CreateTemplateTupleDescCompat(int nattrs, bool hasoid)
@@ -65,4 +66,18 @@ InitPostgresCompat(const char *in_dbname, Oid dboid,
6566
#endif
6667
}
6768

69+
static inline void
70+
get_guc_variables_compat(struct config_generic ***vars, int *num_vars)
71+
{
72+
Assert(vars != NULL);
73+
Assert(num_vars != NULL);
74+
75+
#if PG_VERSION_NUM >= 160000
76+
*vars = get_guc_variables(num_vars);
77+
#else
78+
*vars = get_guc_variables();
79+
*num_vars = GetNumConfigOptions();
80+
#endif
81+
}
82+
6883
#endif

Diff for: pg_wait_sampling.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ setup_gucs()
198198
profile_pid_found = false,
199199
profile_queries_found = false;
200200

201-
guc_vars = get_guc_variables();
202-
numOpts = GetNumConfigOptions();
201+
get_guc_variables_compat(&guc_vars, &numOpts);
203202

204203
for (i = 0; i < numOpts; i++)
205204
{
@@ -452,7 +451,6 @@ pg_wait_sampling_get_current(PG_FUNCTION_ARGS)
452451
{
453452
MemoryContext oldcontext;
454453
TupleDesc tupdesc;
455-
WaitCurrentContext *params;
456454

457455
funcctx = SRF_FIRSTCALL_INIT();
458456

0 commit comments

Comments
 (0)