mirror of
https://github.com/HypoPG/hypopg
synced 2026-05-24 01:28:51 +00:00
Fix compatibility with pg19
The main change is that get_relation_info_hook has been replaced by build_simple_rel_hook in upstream commit https://github.com/postgres/postgres/commit/91f33a2ae92. As mentioned in that commit, the modifications are mostly mechanical.
This commit is contained in:
parent
c7f468adc1
commit
df7cf1e25d
2 changed files with 36 additions and 2 deletions
33
hypopg.c
33
hypopg.c
|
|
@ -31,6 +31,9 @@
|
|||
#endif
|
||||
#include "executor/spi.h"
|
||||
#include "miscadmin.h"
|
||||
#if PG_VERSION_NUM >= 190000
|
||||
#include "optimizer/pathnode.h"
|
||||
#endif
|
||||
#include "utils/elog.h"
|
||||
|
||||
#include "include/hypopg.h"
|
||||
|
|
@ -95,11 +98,18 @@ static ExecutorEnd_hook_type prev_ExecutorEnd_hook = NULL;
|
|||
|
||||
|
||||
static Oid hypo_get_min_fake_oid(void);
|
||||
#if PG_VERSION_NUM < 190000
|
||||
static void hypo_get_relation_info_hook(PlannerInfo *root,
|
||||
Oid relationObjectId,
|
||||
bool inhparent,
|
||||
RelOptInfo *rel);
|
||||
static get_relation_info_hook_type prev_get_relation_info_hook = NULL;
|
||||
#else
|
||||
static void hypo_build_simple_rel_hook(PlannerInfo *root,
|
||||
RelOptInfo *rel,
|
||||
RangeTblEntry *rte);
|
||||
static build_simple_rel_hook_type prev_build_simple_rel_hook = NULL;
|
||||
#endif
|
||||
|
||||
static bool hypo_index_match_table(hypoIndex *entry, Oid relid);
|
||||
static bool hypo_is_simple_explain(Node *node);
|
||||
|
|
@ -114,8 +124,13 @@ _PG_init(void)
|
|||
prev_ExecutorEnd_hook = ExecutorEnd_hook;
|
||||
ExecutorEnd_hook = hypo_executorEnd_hook;
|
||||
|
||||
#if PG_VERSION_NUM < 190000
|
||||
prev_get_relation_info_hook = get_relation_info_hook;
|
||||
get_relation_info_hook = hypo_get_relation_info_hook;
|
||||
#else
|
||||
prev_build_simple_rel_hook = build_simple_rel_hook;
|
||||
build_simple_rel_hook = hypo_build_simple_rel_hook;
|
||||
#endif
|
||||
|
||||
prev_explain_get_index_name_hook = explain_get_index_name_hook;
|
||||
explain_get_index_name_hook = hypo_explain_get_index_name_hook;
|
||||
|
|
@ -494,12 +509,23 @@ hypo_get_min_fake_oid(void)
|
|||
* This function will execute the "hypo_injectHypotheticalIndex" for every
|
||||
* hypothetical index found for each relation if the isExplain flag is setup.
|
||||
*/
|
||||
#if PG_VERSION_NUM < 190000
|
||||
static void
|
||||
hypo_get_relation_info_hook(PlannerInfo *root,
|
||||
Oid relationObjectId,
|
||||
bool inhparent,
|
||||
RelOptInfo *rel)
|
||||
{
|
||||
#else
|
||||
static void
|
||||
hypo_build_simple_rel_hook(PlannerInfo *root,
|
||||
RelOptInfo *rel,
|
||||
RangeTblEntry *rte)
|
||||
{
|
||||
Oid relationObjectId = rte->relid;
|
||||
bool inhparent = rte->inh;
|
||||
#endif
|
||||
|
||||
if (isExplain && hypo_is_enabled)
|
||||
{
|
||||
Relation relation;
|
||||
|
|
@ -519,7 +545,7 @@ hypo_get_relation_info_hook(PlannerInfo *root,
|
|||
{
|
||||
hypoIndex *entry = (hypoIndex *) lfirst(lc);
|
||||
|
||||
if (hypo_index_match_table(entry, RelationGetRelid(relation)))
|
||||
if (hypo_index_match_table(entry, relationObjectId))
|
||||
{
|
||||
/*
|
||||
* hypothetical index found, add it to the relation's
|
||||
|
|
@ -538,8 +564,13 @@ hypo_get_relation_info_hook(PlannerInfo *root,
|
|||
table_close(relation, AccessShareLock);
|
||||
}
|
||||
|
||||
#if PG_VERSION_NUM < 190000
|
||||
if (prev_get_relation_info_hook)
|
||||
prev_get_relation_info_hook(root, relationObjectId, inhparent, rel);
|
||||
#else
|
||||
if (prev_build_simple_rel_hook)
|
||||
prev_build_simple_rel_hook(root, rel, rte);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@
|
|||
#include "utils/ruleutils.h"
|
||||
#endif
|
||||
#include "utils/syscache.h"
|
||||
#if PG_VERSION_NUM >= 190000
|
||||
#include "utils/tuplestore.h"
|
||||
#endif
|
||||
|
||||
#include "include/hypopg.h"
|
||||
#include "include/hypopg_index.h"
|
||||
|
|
@ -136,7 +139,7 @@ hypo_newIndex(Oid relid, char *accessMethod, int nkeycolumns, int ninccolumns,
|
|||
Oid oid;
|
||||
|
||||
#if PG_VERSION_NUM >= 90600
|
||||
IndexAmRoutine *amroutine;
|
||||
const IndexAmRoutine *amroutine;
|
||||
amoptions_function amoptions;
|
||||
#else
|
||||
RegProcedure amoptions;
|
||||
|
|
|
|||
Loading…
Reference in a new issue