summaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2011-01-20 22:44:10 -0500
committerRobert Haas <rhaas@postgresql.org>2011-01-20 22:44:10 -0500
commit8ceb24568054232696dddc1166a8563bc78c900a (patch)
treea9921588da9066933ddf723e79345471909de5e5 /src/backend/commands/tablecmds.c
parent14b9f69cb2077c65a09df78d167d45c35b1d7973 (diff)
Make ALTER TABLE revalidate uniqueness and exclusion constraints.
Failure to do so can lead to constraint violations. This was broken by commit 1ddc2703a936d03953657f43345460b9242bbed1 on 2010-02-07, so back-patch to 9.0. Noah Misch. Regression test by me.
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index f3bd565b986..a9bb8351bc1 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -1076,7 +1076,7 @@ ExecuteTruncate(TruncateStmt *stmt)
/*
* Reconstruct the indexes to match, and we're done.
*/
- reindex_relation(heap_relid, true, false);
+ reindex_relation(heap_relid, true, 0);
}
}
@@ -3236,13 +3236,14 @@ ATRewriteTables(List **wqueue, LOCKMODE lockmode)
/*
* Swap the physical files of the old and new heaps, then rebuild
- * indexes and discard the new heap. We can use RecentXmin for
+ * indexes and discard the old heap. We can use RecentXmin for
* the table's new relfrozenxid because we rewrote all the tuples
* in ATRewriteTable, so no older Xid remains in the table. Also,
* we never try to swap toast tables by content, since we have no
* interest in letting this code work on system catalogs.
*/
- finish_heap_swap(tab->relid, OIDNewHeap, false, false, RecentXmin);
+ finish_heap_swap(tab->relid, OIDNewHeap,
+ false, false, true, RecentXmin);
}
else
{