diff options
Diffstat (limited to 'src/backend/commands/indexcmds.c')
-rw-r--r-- | src/backend/commands/indexcmds.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 351d48ece62..7340a1fc2bb 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -1681,7 +1681,7 @@ ChooseIndexColumnNames(List *indexElems) * Recreate a specific index. */ Oid -ReindexIndex(RangeVar *indexRelation) +ReindexIndex(RangeVar *indexRelation, int options) { Oid indOid; Oid heapOid = InvalidOid; @@ -1706,7 +1706,7 @@ ReindexIndex(RangeVar *indexRelation) persistence = irel->rd_rel->relpersistence; index_close(irel, NoLock); - reindex_index(indOid, false, persistence); + reindex_index(indOid, false, persistence, options); return indOid; } @@ -1775,7 +1775,7 @@ RangeVarCallbackForReindexIndex(const RangeVar *relation, * Recreate all indexes of a table (and of its toast table, if any) */ Oid -ReindexTable(RangeVar *relation) +ReindexTable(RangeVar *relation, int options) { Oid heapOid; @@ -1785,7 +1785,8 @@ ReindexTable(RangeVar *relation) if (!reindex_relation(heapOid, REINDEX_REL_PROCESS_TOAST | - REINDEX_REL_CHECK_CONSTRAINTS)) + REINDEX_REL_CHECK_CONSTRAINTS, + options)) ereport(NOTICE, (errmsg("table \"%s\" has no indexes", relation->relname))); @@ -1802,7 +1803,8 @@ ReindexTable(RangeVar *relation) * That means this must not be called within a user transaction block! */ void -ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind) +ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind, + int options) { Oid objectOid; Relation relationRelation; @@ -1938,11 +1940,14 @@ ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind) PushActiveSnapshot(GetTransactionSnapshot()); if (reindex_relation(relid, REINDEX_REL_PROCESS_TOAST | - REINDEX_REL_CHECK_CONSTRAINTS)) - ereport(DEBUG1, - (errmsg("table \"%s.%s\" was reindexed", - get_namespace_name(get_rel_namespace(relid)), - get_rel_name(relid)))); + REINDEX_REL_CHECK_CONSTRAINTS, + options)) + + if (options & REINDEXOPT_VERBOSE) + ereport(INFO, + (errmsg("table \"%s.%s\" was reindexed", + get_namespace_name(get_rel_namespace(relid)), + get_rel_name(relid)))); PopActiveSnapshot(); CommitTransactionCommand(); } |