PG-1907 Use new executor run hook signature

In commit 3eea7a0 ExecutorRun hook signature changed. Use new singature
for PG18.
pull/571/head
Artem Gavrilov 2025-09-05 17:01:25 +02:00 committed by Artem Gavrilov
parent 182bf40c34
commit d16d7fe6dd
1 changed files with 20 additions and 0 deletions

View File

@ -166,7 +166,11 @@ DECLARE_HOOK(void pgsm_post_parse_analyze, ParseState *pstate, Query *query, Jum
#endif #endif
DECLARE_HOOK(void pgsm_ExecutorStart, QueryDesc *queryDesc, int eflags); 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); 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_ExecutorFinish, QueryDesc *queryDesc);
DECLARE_HOOK(void pgsm_ExecutorEnd, QueryDesc *queryDesc); DECLARE_HOOK(void pgsm_ExecutorEnd, QueryDesc *queryDesc);
#if PG_VERSION_NUM < 160000 #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 * ExecutorRun hook: all we need do is track nesting depth
*/ */
static void static void
#if PG_VERSION_NUM < 180000
pgsm_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count, pgsm_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count,
bool execute_once) bool execute_once)
#else
pgsm_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count)
#endif
{ {
if (nesting_level >= 0 && nesting_level < max_stack_depth) if (nesting_level >= 0 && nesting_level < max_stack_depth)
{ {
@ -600,9 +608,21 @@ pgsm_ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count,
PG_TRY(); PG_TRY();
{ {
if (prev_ExecutorRun) if (prev_ExecutorRun)
{
#if PG_VERSION_NUM < 180000
prev_ExecutorRun(queryDesc, direction, count, execute_once); prev_ExecutorRun(queryDesc, direction, count, execute_once);
#else
prev_ExecutorRun(queryDesc, direction, count);
#endif
}
else else
{
#if PG_VERSION_NUM < 180000
standard_ExecutorRun(queryDesc, direction, count, execute_once); standard_ExecutorRun(queryDesc, direction, count, execute_once);
#else
standard_ExecutorRun(queryDesc, direction, count);
#endif
}
nesting_level--; nesting_level--;
if (nesting_level >= 0 && nesting_level < max_stack_depth) if (nesting_level >= 0 && nesting_level < max_stack_depth)
{ {