diff --git a/pg_wait_sampling.c b/pg_wait_sampling.c
index a0cc582..29f487e 100644
--- a/pg_wait_sampling.c
+++ b/pg_wait_sampling.c
@@ -76,7 +76,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
@@ -976,7 +982,12 @@ 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;
@@ -984,9 +995,9 @@ pgws_ExecutorStart(QueryDesc *queryDesc, int eflags)
 	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