diff options
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index cad83117f95..6bc056bbc33 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -15,7 +15,9 @@ #include "postgres.h" #include "access/genam.h" +#include "access/heapam.h" #include "access/heapam_xlog.h" +#include "access/multixact.h" #include "access/reloptions.h" #include "access/relscan.h" #include "access/sysattr.h" @@ -1130,6 +1132,7 @@ ExecuteTruncate(TruncateStmt *stmt) { Oid heap_relid; Oid toast_relid; + MultiXactId minmulti; /* * This effectively deletes all rows in the table, and may be done @@ -1139,6 +1142,8 @@ ExecuteTruncate(TruncateStmt *stmt) */ CheckTableForSerializableConflictIn(rel); + minmulti = GetOldestMultiXactId(); + /* * Need the full transaction-safe pushups. * @@ -1146,7 +1151,7 @@ ExecuteTruncate(TruncateStmt *stmt) * as the relfilenode value. The old storage file is scheduled for * deletion at commit. */ - RelationSetNewRelfilenode(rel, RecentXmin); + RelationSetNewRelfilenode(rel, RecentXmin, minmulti); if (rel->rd_rel->relpersistence == RELPERSISTENCE_UNLOGGED) heap_create_init_fork(rel); @@ -1159,7 +1164,7 @@ ExecuteTruncate(TruncateStmt *stmt) if (OidIsValid(toast_relid)) { rel = relation_open(toast_relid, AccessExclusiveLock); - RelationSetNewRelfilenode(rel, RecentXmin); + RelationSetNewRelfilenode(rel, RecentXmin, minmulti); if (rel->rd_rel->relpersistence == RELPERSISTENCE_UNLOGGED) heap_create_init_fork(rel); heap_close(rel, NoLock); @@ -3516,7 +3521,8 @@ ATRewriteTables(List **wqueue, LOCKMODE lockmode) * interest in letting this code work on system catalogs. */ finish_heap_swap(tab->relid, OIDNewHeap, - false, false, true, RecentXmin); + false, false, true, RecentXmin, + ReadNextMultiXactId()); } else { |