From 7dff2f54025d04af769b4a01a09e71493ad38929 Mon Sep 17 00:00:00 2001 From: thoshiai <45982834+thoshiai@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:28:39 +0900 Subject: [PATCH] Add support for PostgreSQL 17 (#84) This commit allows to use pg_ivm with the latest master branch code of PostgreSQL. We may need additional fixes because PG17 is not released yet, though. --- createas.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/createas.c b/createas.c index f62070a..dba81c8 100644 --- a/createas.c +++ b/createas.c @@ -1375,7 +1375,11 @@ CreateIndexOnIMMV(Query *query, Relation matviewRel) index->excludeOpNames = NIL; index->idxcomment = NULL; index->indexOid = InvalidOid; -#if defined(PG_VERSION_NUM) && (PG_VERSION_NUM >= 160000) +#if defined(PG_VERSION_NUM) && (PG_VERSION_NUM >= 170000) + index->iswithoutoverlaps = false; + index->oldNumber = InvalidRelFileNumber; + index->oldFirstRelfilelocatorSubid = InvalidSubTransactionId; +#elif defined(PG_VERSION_NUM) && (PG_VERSION_NUM >= 160000) index->oldNumber = InvalidRelFileNumber; index->oldFirstRelfilelocatorSubid = InvalidSubTransactionId; #else @@ -1482,10 +1486,18 @@ CreateIndexOnIMMV(Query *query, Relation matviewRel) indexRel = index_open(indexoid, AccessShareLock); +#if defined(PG_VERSION_NUM) && (PG_VERSION_NUM >= 170000) + if (CheckIndexCompatible(indexRel->rd_id, + index->accessMethod, + index->indexParams, + index->excludeOpNames, + index->iswithoutoverlaps)) +#else if (CheckIndexCompatible(indexRel->rd_id, index->accessMethod, index->indexParams, index->excludeOpNames)) +#endif hasCompatibleIndex = true; index_close(indexRel, AccessShareLock);