diff options
author | Noah Misch <noah@leadboat.com> | 2013-07-30 18:36:52 -0400 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2013-07-30 18:39:31 -0400 |
commit | 9a78f66fdccbc85442f992f2928b4a58ae451208 (patch) | |
tree | 798749e264309e12b34f4b668ece37192c5535b7 /src/backend/commands/indexcmds.c | |
parent | e243e3a42887f82be6dc5a6bf6e8534a733b8bc8 (diff) | |
download | postgresql-9a78f66fdccbc85442f992f2928b4a58ae451208.tar.gz postgresql-9a78f66fdccbc85442f992f2928b4a58ae451208.zip |
Restore REINDEX constraint validation.
Refactoring as part of commit 8ceb24568054232696dddc1166a8563bc78c900a
had the unintended effect of making REINDEX TABLE and REINDEX DATABASE
no longer validate constraints enforced by the indexes in question;
REINDEX INDEX still did so. Indexes marked invalid remained so, and
constraint violations arising from data corruption went undetected.
Back-patch to 9.0, like the causative commit.
Diffstat (limited to 'src/backend/commands/indexcmds.c')
-rw-r--r-- | src/backend/commands/indexcmds.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 1ca53bad037..72084e18432 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -1768,7 +1768,9 @@ ReindexTable(RangeVar *relation) heapOid = RangeVarGetRelidExtended(relation, ShareLock, false, false, RangeVarCallbackOwnsTable, NULL); - if (!reindex_relation(heapOid, REINDEX_REL_PROCESS_TOAST)) + if (!reindex_relation(heapOid, + REINDEX_REL_PROCESS_TOAST | + REINDEX_REL_CHECK_CONSTRAINTS)) ereport(NOTICE, (errmsg("table \"%s\" has no indexes", relation->relname))); @@ -1884,7 +1886,9 @@ 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, REINDEX_REL_PROCESS_TOAST)) + if (reindex_relation(relid, + REINDEX_REL_PROCESS_TOAST | + REINDEX_REL_CHECK_CONSTRAINTS)) ereport(NOTICE, (errmsg("table \"%s.%s\" was reindexed", get_namespace_name(get_rel_namespace(relid)), |