diff options
Diffstat (limited to 'src/backend/commands/cluster.c')
-rw-r--r-- | src/backend/commands/cluster.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 19c3cf9674c..59a439413e1 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -565,7 +565,7 @@ rebuild_relation(Relation OldHeap, Oid indexOid, * rebuild the target's indexes and throw away the transient table. */ finish_heap_swap(tableOid, OIDNewHeap, is_system_catalog, - swap_toast_by_content, frozenXid); + swap_toast_by_content, false, frozenXid); } @@ -1362,10 +1362,12 @@ void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap, bool is_system_catalog, bool swap_toast_by_content, + bool check_constraints, TransactionId frozenXid) { ObjectAddress object; Oid mapped_tables[4]; + int reindex_flags; int i; /* Zero out possible results from swapped_relation_files */ @@ -1395,7 +1397,10 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap, * so no chance to reclaim disk space before commit. We do not need a * final CommandCounterIncrement() because reindex_relation does it. */ - reindex_relation(OIDOldHeap, false, true); + reindex_flags = REINDEX_SUPPRESS_INDEX_USE; + if (check_constraints) + reindex_flags |= REINDEX_CHECK_CONSTRAINTS; + reindex_relation(OIDOldHeap, false, reindex_flags); /* Destroy new heap with old filenode */ object.classId = RelationRelationId; |