diff options
author | Robert Haas <rhaas@postgresql.org> | 2010-12-29 06:48:53 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2010-12-29 06:48:53 -0500 |
commit | 53dbc27c62d8e1b6c5253feba04a5094cb8fe046 (patch) | |
tree | b27563b69fa73dc4b7dc873bfc653bedc6ba1e05 /src/backend/catalog/index.c | |
parent | 9b8aff8c192e2f313f90395d114c58a9ef84f97f (diff) | |
download | postgresql-53dbc27c62d8e1b6c5253feba04a5094cb8fe046.tar.gz postgresql-53dbc27c62d8e1b6c5253feba04a5094cb8fe046.zip |
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.
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. */ |