From a20ef23ac500b55b0da75727d264357068cc2f92 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Wed, 8 Jul 2026 13:03:38 +0300 Subject: [PATCH] =?utf8?q?-=20fix=20"function=20declaration=20isn=E2=80=99?= =?utf8?q?t=20a=20prototype"=20-=20use=20build=5Fsimple=5Frel=5Fhook=20ins?= =?utf8?q?tead=20of=20get=5Frelation=5Finfo=5Fhook=20for=20PG=2019?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Marina Polyakova --- plantuner.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) 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 } -- 2.49.0