From 33ea28b53814a70e7af2d722d41e368bc8a16da6 Mon Sep 17 00:00:00 2001 From: Julien Rouhaud Date: Tue, 9 Oct 2018 23:24:39 +0200 Subject: [PATCH] Fix compatibility with pg12 (commit fdba460a26a) Also fix a warning for an unused variable with version prior pg10 --- hypopg.c | 4 +++- hypopg_import.c | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hypopg.c b/hypopg.c index 17d9a13..e298956 100644 --- a/hypopg.c +++ b/hypopg.c @@ -464,8 +464,10 @@ hypo_get_relation_info_hook(PlannerInfo *root, bool inhparent, RelOptInfo *rel) { - bool hypopart = false; Relation relation; +#if PG_VERSION_NUM >= 100000 + bool hypopart = false; +#endif if (HYPO_ENABLED()) { diff --git a/hypopg_import.c b/hypopg_import.c index 43f36c2..d2613b9 100644 --- a/hypopg_import.c +++ b/hypopg_import.c @@ -419,7 +419,11 @@ transformPartitionSpec(Relation rel, PartitionSpec *partspec, char *strategy) * rangetable entry. We need a ParseState for transformExpr. */ pstate = make_parsestate(NULL); - rte = addRangeTableEntryForRelation(pstate, rel, NULL, false, true); + rte = addRangeTableEntryForRelation(pstate, rel, +#if PG_VERSION_NUM >= 120000 + AccessShareLock, +#endif + NULL, false, true); addRTEtoQuery(pstate, rte, true, true, true); /* take care of any partition expressions */