diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 1c1d0da..1520d32 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -1685,6 +1685,8 @@ ReindexIndex(RangeVar *indexRelation) { Oid indOid; Oid heapOid = InvalidOid; + Relation irel; + char relpersistence; /* lock level used here should match index lock reindex_index() */ indOid = RangeVarGetRelidExtended(indexRelation, AccessExclusiveLock, @@ -1692,7 +1694,11 @@ ReindexIndex(RangeVar *indexRelation) RangeVarCallbackForReindexIndex, (void *) &heapOid); - reindex_index(indOid, false, indexRelation->relpersistence); + irel = index_open(indOid, AccessExclusiveLock); + relpersistence = irel->rd_rel->relpersistence; + index_close(irel, NoLock); + + reindex_index(indOid, false, relpersistence); return indOid; }