@@ -380,7 +380,11 @@ pg_wait_sampling_get_current(PG_FUNCTION_ARGS)
380380params -> ts = GetCurrentTimestamp ();
381381
382382funcctx -> user_fctx = params ;
383+ #if PG_VERSION_NUM >=120000
384+ tupdesc = CreateTemplateTupleDesc (4 );
385+ #else
383386tupdesc = CreateTemplateTupleDesc (4 , false);
387+ #endif
384388TupleDescInitEntry (tupdesc , (AttrNumber )1 ,"pid" ,
385389INT4OID ,-1 ,0 );
386390TupleDescInitEntry (tupdesc , (AttrNumber )2 ,"type" ,
@@ -585,7 +589,11 @@ pg_wait_sampling_get_profile(PG_FUNCTION_ARGS)
585589funcctx -> max_calls = profile -> count ;
586590
587591/* Make tuple descriptor */
592+ #if PG_VERSION_NUM >=120000
593+ tupdesc = CreateTemplateTupleDesc (5 );
594+ #else
588595tupdesc = CreateTemplateTupleDesc (5 , false);
596+ #endif
589597TupleDescInitEntry (tupdesc , (AttrNumber )1 ,"pid" ,
590598INT4OID ,-1 ,0 );
591599TupleDescInitEntry (tupdesc , (AttrNumber )2 ,"type" ,
@@ -703,7 +711,11 @@ pg_wait_sampling_get_history(PG_FUNCTION_ARGS)
703711funcctx -> max_calls = history -> count ;
704712
705713/* Make tuple descriptor */
714+ #if PG_VERSION_NUM >=120000
715+ tupdesc = CreateTemplateTupleDesc (5 );
716+ #else
706717tupdesc = CreateTemplateTupleDesc (5 , false);
718+ #endif
707719TupleDescInitEntry (tupdesc , (AttrNumber )1 ,"pid" ,
708720INT4OID ,-1 ,0 );
709721TupleDescInitEntry (tupdesc , (AttrNumber )2 ,"sample_ts" ,