- use build_simple_rel_hook instead of get_relation_info_hook for PG 19
Marina Polyakova
#include <nodes/miscnodes.h>
#endif
#include <nodes/pg_list.h>
#include <nodes/miscnodes.h>
#endif
#include <nodes/pg_list.h>
+#if PG_VERSION_NUM >= 190000
+#include <optimizer/pathnode.h>
+#endif
#include <optimizer/plancat.h>
#include <storage/bufmgr.h>
#include <utils/builtins.h>
#include <optimizer/plancat.h>
#include <storage/bufmgr.h>
#include <utils/builtins.h>
static Oid *onlyIndexes = NULL;
static char *onlyIndexesOutStr = "";
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;
static get_relation_info_hook_type prevHook = NULL;
static bool fix_empty_table = false;
static bool plantuner_enable_inited = false;
static bool fix_empty_table = false;
static bool plantuner_enable_inited = false;
{
if (!plantuner_only_inited)
indexesAssign(onlyIndexesOutStr, true, PGC_S_USER, OnlyKind);
{
if (!plantuner_only_inited)
indexesAssign(onlyIndexesOutStr, true, PGC_S_USER, OnlyKind);
+#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)
{
execPlantuner(PlannerInfo *root, Oid relationObjectId, bool inhparent,
RelOptInfo *rel)
{
Relation relation;
relation = heap_open(relationObjectId, NoLock);
Relation relation;
relation = heap_open(relationObjectId, NoLock);
* Call next hook if it exists
*/
if (prevHook)
* Call next hook if it exists
*/
if (prevHook)
+#if PG_VERSION_NUM >= 190000
+ prevHook(root, rel, rte);
+#else
prevHook(root, relationObjectId, inhparent, rel);
prevHook(root, relationObjectId, inhparent, rel);
+#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;
}
if (get_relation_info_hook != execPlantuner )
{
prevHook = get_relation_info_hook;
get_relation_info_hook = execPlantuner;
}