From d16d7fe6ddca475e98e929247903b72bfa7cd232 Mon Sep 17 00:00:00 2001 From: Artem Gavrilov Date: Fri, 5 Sep 2025 17:01:25 +0200 Subject: [PATCH] PG-1907 Use new executor run hook signature In commit 3eea7a0 ExecutorRun hook signature changed. Use new singature for PG18. --- pg_stat_monitor.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pg_stat_monitor.c b/pg_stat_monitor.c index 2db8eb8..a5cb9f1 100644 --- a/pg_stat_monitor.c +++ b/pg_stat_monitor.c @@ -166,7 +166,11 @@ DECLARE_HOOK(void pgsm_post_parse_analyze, ParseState *pstate, Query *query, Jum #endif DECLARE_HOOK(void pgsm_ExecutorStart, QueryDesc *queryDesc, int eflags); +#if PG_VERSION_NUM < 180000 DECLARE_HOOK(void pgsm_ExecutorRun, QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once); +#else +DECLARE_HOOK(void pgsm_ExecutorRun, QueryDesc *queryDesc, ScanDirection direction, uint64 count); +#endif DECLARE_HOOK(void pgsm_ExecutorFinish, QueryDesc *queryDesc); DECLARE_HOOK(void pgsm_ExecutorEnd, QueryDesc *queryDesc); #if PG_VERSION_NUM < 160000 @@ -587,8 +591,12 @@ pgsm_ExecutorStart(QueryDesc *queryDesc, int eflags) * ExecutorRun hook: all we need do is track nesting depth */ static void +#if PG_VERSION_NUM < 180000 pgsm_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once) +#else +pgsm_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count) +#endif { if (nesting_level >= 0 && nesting_level < max_stack_depth) { @@ -600,9 +608,21 @@ pgsm_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count, PG_TRY(); { if (prev_ExecutorRun) + { +#if PG_VERSION_NUM < 180000 prev_ExecutorRun(queryDesc, direction, count, execute_once); +#else + prev_ExecutorRun(queryDesc, direction, count); +#endif + } else + { +#if PG_VERSION_NUM < 180000 standard_ExecutorRun(queryDesc, direction, count, execute_once); +#else + standard_ExecutorRun(queryDesc, direction, count); +#endif + } nesting_level--; if (nesting_level >= 0 && nesting_level < max_stack_depth) {