Skip to content

Commit 8bd3842

Browse files
rjujuakorotkov
authored andcommitted
Add PostgreSQL 12 compatibility.
578b229718e (remove WITH OIDS support) changed CreateTemplateTupleDesc() signature.
1 parent 03fb0d1 commit 8bd3842

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: pg_wait_sampling.c

+12
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,11 @@ pg_wait_sampling_get_current(PG_FUNCTION_ARGS)
380380
params->ts = GetCurrentTimestamp();
381381

382382
funcctx->user_fctx = params;
383+
#if PG_VERSION_NUM >= 120000
384+
tupdesc = CreateTemplateTupleDesc(4);
385+
#else
383386
tupdesc = CreateTemplateTupleDesc(4, false);
387+
#endif
384388
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "pid",
385389
INT4OID, -1, 0);
386390
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "type",
@@ -585,7 +589,11 @@ pg_wait_sampling_get_profile(PG_FUNCTION_ARGS)
585589
funcctx->max_calls = profile->count;
586590

587591
/* Make tuple descriptor */
592+
#if PG_VERSION_NUM >= 120000
593+
tupdesc = CreateTemplateTupleDesc(5);
594+
#else
588595
tupdesc = CreateTemplateTupleDesc(5, false);
596+
#endif
589597
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "pid",
590598
INT4OID, -1, 0);
591599
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "type",
@@ -703,7 +711,11 @@ pg_wait_sampling_get_history(PG_FUNCTION_ARGS)
703711
funcctx->max_calls = history->count;
704712

705713
/* Make tuple descriptor */
714+
#if PG_VERSION_NUM >= 120000
715+
tupdesc = CreateTemplateTupleDesc(5);
716+
#else
706717
tupdesc = CreateTemplateTupleDesc(5, false);
718+
#endif
707719
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "pid",
708720
INT4OID, -1, 0);
709721
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "sample_ts",

0 commit comments

Comments
 (0)