1818#include "optimizer/planner.h"
1919#include "pgstat.h"
2020#include "postmaster/autovacuum.h"
21- #if PG_VERSION_NUM >= 120000
2221#include "replication/walsender.h"
23- #endif
2422#include "storage/ipc.h"
2523#include "storage/pg_shmem.h"
2624#include "storage/procarray.h"
@@ -119,9 +117,7 @@ get_max_procs_count(void)
119117 * Starting with pg12, wal senders aren't part of MaxConnections anymore
120118 * and have to be accounted for.
121119 */
122- #if PG_VERSION_NUM >= 120000
123120 count += max_wal_senders ;
124- #endif /* pg 12+ */
125121#endif /* pg 15- */
126122 /* End of MaxBackends calculation. */
127123
@@ -331,16 +327,9 @@ pgws_shmem_startup(void)
331327 else
332328 {
333329 toc = shm_toc_attach (PG_WAIT_SAMPLING_MAGIC , pgws );
334-
335- #if PG_VERSION_NUM >= 100000
336330 pgws_collector_hdr = shm_toc_lookup (toc , 0 , false);
337331 pgws_collector_mq = shm_toc_lookup (toc , 1 , false);
338332 pgws_proc_queryids = shm_toc_lookup (toc , 2 , false);
339- #else
340- pgws_collector_hdr = shm_toc_lookup (toc , 0 );
341- pgws_collector_mq = shm_toc_lookup (toc , 1 );
342- pgws_proc_queryids = shm_toc_lookup (toc , 2 );
343- #endif
344333 }
345334
346335 shmem_initialized = true;
@@ -366,7 +355,7 @@ static void
366355pgws_cleanup_callback (int code , Datum arg )
367356{
368357 elog (DEBUG3 , "pg_wait_sampling cleanup: detaching shm_mq and releasing queue lock" );
369- shm_mq_detach_compat (recv_mqh , recv_mq );
358+ shm_mq_detach (recv_mqh );
370359 LockRelease (& queueTag , ExclusiveLock , false);
371360}
372361
@@ -463,7 +452,7 @@ pg_wait_sampling_get_current(PG_FUNCTION_ARGS)
463452 params -> ts = GetCurrentTimestamp ();
464453
465454 funcctx -> user_fctx = params ;
466- tupdesc = CreateTemplateTupleDescCompat ( 4 , false );
455+ tupdesc = CreateTemplateTupleDesc ( 4 );
467456 TupleDescInitEntry (tupdesc , (AttrNumber ) 1 , "pid" ,
468457 INT4OID , -1 , 0 );
469458 TupleDescInitEntry (tupdesc , (AttrNumber ) 2 , "type" ,
@@ -651,7 +640,7 @@ receive_array(SHMRequest request, Size item_size, Size *count)
651640 PG_END_ENSURE_ERROR_CLEANUP (pgws_cleanup_callback , 0 );
652641
653642 /* We still have to detach and release lock during normal operation. */
654- shm_mq_detach_compat (recv_mqh , recv_mq );
643+ shm_mq_detach (recv_mqh );
655644 LockRelease (& queueTag , ExclusiveLock , false);
656645
657646 return result ;
@@ -684,7 +673,7 @@ pg_wait_sampling_get_profile(PG_FUNCTION_ARGS)
684673 funcctx -> max_calls = profile -> count ;
685674
686675 /* Make tuple descriptor */
687- tupdesc = CreateTemplateTupleDescCompat ( 5 , false );
676+ tupdesc = CreateTemplateTupleDesc ( 5 );
688677 TupleDescInitEntry (tupdesc , (AttrNumber ) 1 , "pid" ,
689678 INT4OID , -1 , 0 );
690679 TupleDescInitEntry (tupdesc , (AttrNumber ) 2 , "type" ,
@@ -801,7 +790,7 @@ pg_wait_sampling_get_history(PG_FUNCTION_ARGS)
801790 funcctx -> max_calls = history -> count ;
802791
803792 /* Make tuple descriptor */
804- tupdesc = CreateTemplateTupleDescCompat ( 5 , false );
793+ tupdesc = CreateTemplateTupleDesc ( 5 );
805794 TupleDescInitEntry (tupdesc , (AttrNumber ) 1 , "pid" ,
806795 INT4OID , -1 , 0 );
807796 TupleDescInitEntry (tupdesc , (AttrNumber ) 2 , "sample_ts" ,
@@ -879,17 +868,6 @@ pgws_planner_hook(Query *parse,
879868 if (MyProc )
880869 {
881870 int i = MyProc - ProcGlobal -> allProcs ;
882- #if PG_VERSION_NUM >= 110000
883- /*
884- * since we depend on queryId we need to check that its size
885- * is uint64 as we coded in pg_wait_sampling
886- */
887- StaticAssertExpr (sizeof (parse -> queryId ) == sizeof (uint64 ),
888- "queryId size is not uint64" );
889- #else
890- StaticAssertExpr (sizeof (parse -> queryId ) == sizeof (uint32 ),
891- "queryId size is not uint32" );
892- #endif
893871 if (!pgws_proc_queryids [i ])
894872 pgws_proc_queryids [i ] = parse -> queryId ;
895873
@@ -921,17 +899,6 @@ pgws_ExecutorStart(QueryDesc *queryDesc, int eflags)
921899 if (MyProc )
922900 {
923901 i = MyProc - ProcGlobal -> allProcs ;
924- #if PG_VERSION_NUM >= 110000
925- /*
926- * since we depend on queryId we need to check that its size
927- * is uint64 as we coded in pg_wait_sampling
928- */
929- StaticAssertExpr (sizeof (queryDesc -> plannedstmt -> queryId ) == sizeof (uint64 ),
930- "queryId size is not uint64" );
931- #else
932- StaticAssertExpr (sizeof (queryDesc -> plannedstmt -> queryId ) == sizeof (uint32 ),
933- "queryId size is not uint32" );
934- #endif
935902 if (!pgws_proc_queryids [i ])
936903 pgws_proc_queryids [i ] = queryDesc -> plannedstmt -> queryId ;
937904 }
0 commit comments