diff --git a/src/backend/access/common/fasttab.c b/src/backend/access/common/fasttab.c index 7fee66c357..3fb2df93e5 100644 --- a/src/backend/access/common/fasttab.c +++ b/src/backend/access/common/fasttab.c @@ -1187,7 +1187,7 @@ fasttab_insert(Relation relation, HeapTuple tup, HeapTuple heaptup, Oid *result, if (!import_mode) { - //CacheInvalidateHeapTuple(relation, dlist_tup->tup, NULL); + CacheInvalidateHeapTuple(relation, dlist_tup->tup, NULL); pgstat_count_heap_insert(relation, 1); } @@ -1321,7 +1321,7 @@ fasttab_delete(Relation relation, ItemPointer tid) } pgstat_count_heap_delete(relation); - // CacheInvalidateHeapTuple(relation, dlist_tup->tup, NULL); + CacheInvalidateHeapTuple(relation, dlist_tup->tup, NULL); dlist_delete(&dlist_tup->node); DListHeapTupleFree(dlist_tup); @@ -1373,7 +1373,7 @@ fasttab_update(Relation relation, ItemPointer otid, HeapTuple newtup) { MemoryContext oldctx = MemoryContextSwitchTo(GetLocalMemoryContext()); - // CacheInvalidateHeapTuple(relation, dlist_tup->tup, newtup); + CacheInvalidateHeapTuple(relation, dlist_tup->tup, newtup); heap_freetuple(dlist_tup->tup); newtup->t_self = GenFasttabItemPointerData(); dlist_tup->tup = heap_copytuple(newtup); @@ -1427,8 +1427,8 @@ fasttab_inplace_update(Relation relation, HeapTuple tuple) { MemoryContext oldctx = MemoryContextSwitchTo(GetLocalMemoryContext()); - // if (!IsBootstrapProcessingMode()) - //CacheInvalidateHeapTuple(relation, tuple, NULL); + if (!IsBootstrapProcessingMode()) + CacheInvalidateHeapTuple(relation, tuple, NULL); heap_freetuple(dlist_tup->tup); dlist_tup->tup = heap_copytuple(tuple); diff --git a/src/backend/catalog/storage.c b/src/backend/catalog/storage.c index 632c768080..a4627abd4c 100644 --- a/src/backend/catalog/storage.c +++ b/src/backend/catalog/storage.c @@ -83,11 +83,14 @@ RelationCreateStorage(RelFileNode rnode, char relpersistence, char relstorage) SMgrRelation srel; BackendId backend; bool needs_wal; + bool no_error_on_exists; + + no_error_on_exists = RELPERSISTENCE_FAST_TEMP == relpersistence; switch (relpersistence) { - case RELPERSISTENCE_TEMP: case RELPERSISTENCE_FAST_TEMP: + case RELPERSISTENCE_TEMP: backend = TempRelBackendId; needs_wal = false; break; @@ -105,6 +108,8 @@ RelationCreateStorage(RelFileNode rnode, char relpersistence, char relstorage) } srel = smgropen(rnode, backend); + if (no_error_on_exists && srel->smgr->smgr_exists(srel, MAIN_FORKNUM)) + return; smgrcreate(srel, MAIN_FORKNUM, false); if (needs_wal)