From: Teodor Sigaev Date: Wed, 8 Jul 2026 10:03:38 +0000 (+0300) Subject: - fix "function declaration isn’t a prototype" X-Git-Url: http://sigaev.ru/git/gitweb.cgi?a=commitdiff_plain;h=a20ef23ac500b55b0da75727d264357068cc2f92;p=plantuner.git - fix "function declaration isn’t a prototype" - use build_simple_rel_hook instead of get_relation_info_hook for PG 19 Marina Polyakova --- diff --git a/plantuner.c b/plantuner.c index 0148a75..d31dbbb 100644 --- a/plantuner.c +++ b/plantuner.c @@ -39,6 +39,9 @@ #include #endif #include +#if PG_VERSION_NUM >= 190000 +#include +#endif #include #include #include @@ -69,7 +72,12 @@ static int nOnlyIndexes = 0; static Oid *onlyIndexes = NULL; static char *onlyIndexesOutStr = ""; +#if PG_VERSION_NUM >= 190000 +static build_simple_rel_hook_type prevHook = NULL; +#else static get_relation_info_hook_type prevHook = NULL; +#endif + static bool fix_empty_table = false; static bool plantuner_enable_inited = false; @@ -261,7 +269,7 @@ assignOnlyIndexes(const char * newval, bool doit, GucSource source) } static void -lateInit() +lateInit(void) { if (!plantuner_only_inited) indexesAssign(onlyIndexesOutStr, true, PGC_S_USER, OnlyKind); @@ -399,9 +407,16 @@ restart1: } static void +#if PG_VERSION_NUM >= 190000 +execPlantuner(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte) +{ + Oid relationObjectId = rte->relid; + bool inhparent = rte->inh; +#else execPlantuner(PlannerInfo *root, Oid relationObjectId, bool inhparent, RelOptInfo *rel) { +#endif Relation relation; relation = heap_open(relationObjectId, NoLock); @@ -425,7 +440,11 @@ execPlantuner(PlannerInfo *root, Oid relationObjectId, bool inhparent, * Call next hook if it exists */ if (prevHook) +#if PG_VERSION_NUM >= 190000 + prevHook(root, rel, rte); +#else prevHook(root, relationObjectId, inhparent, rel); +#endif } static const char* @@ -568,9 +587,17 @@ _PG_init(void) NULL ); +#if PG_VERSION_NUM >= 190000 + if (build_simple_rel_hook != execPlantuner ) + { + prevHook = build_simple_rel_hook; + build_simple_rel_hook = execPlantuner; + } +#else if (get_relation_info_hook != execPlantuner ) { prevHook = get_relation_info_hook; get_relation_info_hook = execPlantuner; } +#endif }