mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Support unlogged tables.
The contents of an unlogged table are WAL-logged; thus, they are not available on standby servers and are truncated whenever the database system enters recovery. Indexes on unlogged tables are also unlogged. Unlogged GiST indexes are not currently supported.
This commit is contained in:
@@ -1437,6 +1437,17 @@ index_build(Relation heapRelation,
|
||||
PointerGetDatum(indexInfo)));
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user