1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-22 02:52:08 +03:00

Make ALTER TABLE revalidate uniqueness and exclusion constraints.

Failure to do so can lead to constraint violations.  This was broken by
commit 1ddc2703a9 on 2010-02-07, so
back-patch to 9.0.

Noah Misch.  Regression test by me.
This commit is contained in:
Robert Haas
2011-01-20 22:44:10 -05:00
parent 14b9f69cb2
commit 8ceb245680
8 changed files with 48 additions and 27 deletions

View File

@ -1629,7 +1629,7 @@ ReindexTable(RangeVar *relation)
ReleaseSysCache(tuple);
if (!reindex_relation(heapOid, true, false))
if (!reindex_relation(heapOid, true, 0))
ereport(NOTICE,
(errmsg("table \"%s\" has no indexes",
relation->relname)));
@ -1742,7 +1742,7 @@ ReindexDatabase(const char *databaseName, bool do_system, bool do_user)
StartTransactionCommand();
/* functions in indexes may want a snapshot set */
PushActiveSnapshot(GetTransactionSnapshot());
if (reindex_relation(relid, true, false))
if (reindex_relation(relid, true, 0))
ereport(NOTICE,
(errmsg("table \"%s.%s\" was reindexed",
get_namespace_name(get_rel_namespace(relid)),