Fix compile with PG17 (#76)

Support for PostgreSQL17
Rename OverrideSearchPath to SearchPathMatcher from PG17.
This commit is contained in:
reshke 2024-03-25 05:25:27 +05:00 committed by GitHub
parent 9736c8c832
commit 76888cd975
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -80,8 +80,14 @@ typedef struct MV_QueryHashEntry
{
MV_QueryKey key;
SPIPlanPtr plan;
#if PG_VERSION_NUM < 170000
OverrideSearchPath *search_path; /* search_path used for parsing
* and planning */
#else
SearchPathMatcher *search_path; /* search_path used for parsing
* and planning */
#endif
} MV_QueryHashEntry;
@ -3066,7 +3072,11 @@ mv_FetchPreparedPlan(MV_QueryKey *key)
*/
plan = entry->plan;
if (plan && SPI_plan_is_valid(plan) &&
#if PG_VERSION_NUM < 170000
OverrideSearchPathMatchesCurrent(entry->search_path))
#else
SearchPathMatchesCurrentEnvironment(entry->search_path))
#endif
return plan;
/*
@ -3110,7 +3120,11 @@ mv_HashPreparedPlan(MV_QueryKey *key, SPIPlanPtr plan)
HASH_ENTER, &found);
Assert(!found || entry->plan == NULL);
entry->plan = plan;
#if PG_VERSION_NUM < 170000
entry->search_path = GetOverrideSearchPath(TopMemoryContext);
#else
entry->search_path = GetSearchPathMatcher(TopMemoryContext);
#endif
}
/*