On Tue, Mar 24, 2015 at 8:46 PM, Thom Brown wrote: > The index is unlogged until reindexing... > > [...] > Which is think also raises the question, why are unlogged indexes made > persistent by a reindex?
That's a bug of HEAD, ~9.4 keeping the index as unlogged even after REINDEX INDEX. What happens is that ReindexIndex relies on relpersistence provided by makeRangeVar at parse time, which is just incorrect as it uses RELPERSISTENCE_PERMANENT all the time. The patch attached fixes that... -- Michael
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; }
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers