diff options
Diffstat (limited to 'src/backend/catalog/index.c')
-rw-r--r-- | src/backend/catalog/index.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 8fbe8ebc91d..e50a084f003 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -1438,6 +1438,17 @@ index_build(Relation heapRelation, Assert(PointerIsValid(stats)); /* + * If this is an unlogged index, we need to write out an init fork for it. + */ + if (heapRelation->rd_rel->relpersistence == RELPERSISTENCE_UNLOGGED) + { + RegProcedure ambuildempty = indexRelation->rd_am->ambuildempty; + RelationOpenSmgr(indexRelation); + smgrcreate(indexRelation->rd_smgr, INIT_FORKNUM, false); + OidFunctionCall1(ambuildempty, PointerGetDatum(indexRelation)); + } + + /* * If it's for an exclusion constraint, make a second pass over the heap * to verify that the constraint is satisfied. */ |