From dd524f2dde44b3907aa457777192c19d3dba9097 Mon Sep 17 00:00:00 2001 From: Georgy Shelkovy Date: Fri, 21 Feb 2025 09:08:18 +0500 Subject: [PATCH] Fix compatibility with pg18 Upstream commit postgres/postgres@525392d changed return type of ExecutorStart_hook API from void to bool. --- pg_wait_sampling.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pg_wait_sampling.c b/pg_wait_sampling.c index 153d875..0a12003 100644 --- a/pg_wait_sampling.c +++ b/pg_wait_sampling.c @@ -73,7 +73,13 @@ static PlannedStmt *pgws_planner_hook(Query *parse, const char *query_string, #endif int cursorOptions, ParamListInfo boundParams); -static void pgws_ExecutorStart(QueryDesc *queryDesc, int eflags); +static +#if PG_VERSION_NUM >= 180000 +bool +#else +void +#endif +pgws_ExecutorStart(QueryDesc *queryDesc, int eflags); static void pgws_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count @@ -965,16 +971,21 @@ pgws_planner_hook(Query *parse, /* * ExecutorStart hook: save queryId for collector */ -static void +static +#if PG_VERSION_NUM >= 180000 +bool +#else +void +#endif pgws_ExecutorStart(QueryDesc *queryDesc, int eflags) { int i = MyProc - ProcGlobal->allProcs; if (pgws_enabled(nesting_level)) pgws_proc_queryids[i] = queryDesc->plannedstmt->queryId; if (prev_ExecutorStart) - prev_ExecutorStart(queryDesc, eflags); + return prev_ExecutorStart(queryDesc, eflags); else - standard_ExecutorStart(queryDesc, eflags); + return standard_ExecutorStart(queryDesc, eflags); } static void