*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.190 2002/08/28 20:46:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.191 2002/08/29 15:56:19 tgl Exp $
*
*
* INTERFACE ROUTINES
Buffer buffer;
RelationData workrel;
- Assert(!IsSystemRelation(relation) || relation->rd_rel->relkind == RELKIND_INDEX);
+ Assert(!IsSystemRelation(relation) || IsToastRelation(relation) ||
+ relation->rd_rel->relkind == RELKIND_INDEX);
pg_class = heap_openr(RelationRelationName, RowExclusiveLock);
/* Fetch and lock the classTuple associated with this relation */
* ignore the indexes of the target system relation while processing
* reindex.
*/
- if (!IsIgnoringSystemIndexes() && IsSystemRelation(rel))
+ if (!IsIgnoringSystemIndexes() &&
+ IsSystemRelation(rel) && !IsToastRelation(rel))
deactivate_needed = true;
#ifndef ENABLE_REINDEX_NAILED_RELATIONS
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.84 2002/08/16 20:55:09 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.85 2002/08/29 15:56:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
/*
- * Reindex
+ * ReindexIndex
* Recreate an index.
- *
- * Exceptions:
- * "ERROR" if index nonexistent.
- * ...
*/
void
ReindexIndex(RangeVar *indexRelation, bool force /* currently unused */ )
indexRelation->relname,
((Form_pg_class) GETSTRUCT(tuple))->relkind);
- if (IsSystemClass((Form_pg_class) GETSTRUCT(tuple)))
+ if (IsSystemClass((Form_pg_class) GETSTRUCT(tuple)) &&
+ !IsToastClass((Form_pg_class) GETSTRUCT(tuple)))
{
if (!allowSystemTableMods)
elog(ERROR, "\"%s\" is a system index. call REINDEX under standalone postgres with -O -P options",
/*
* ReindexTable
* Recreate indexes of a table.
- *
- * Exceptions:
- * "ERROR" if table nonexistent.
- * ...
*/
void
ReindexTable(RangeVar *relation, bool force)
{
Oid heapOid;
HeapTuple tuple;
+ char relkind;
/*
* REINDEX within a transaction block is dangerous, because if the
0, 0, 0);
if (!HeapTupleIsValid(tuple))
elog(ERROR, "table \"%s\" does not exist", relation->relname);
+ relkind = ((Form_pg_class) GETSTRUCT(tuple))->relkind;
- if (((Form_pg_class) GETSTRUCT(tuple))->relkind != RELKIND_RELATION)
+ if (relkind != RELKIND_RELATION && relkind != RELKIND_TOASTVALUE)
elog(ERROR, "relation \"%s\" is of type \"%c\"",
- relation->relname,
- ((Form_pg_class) GETSTRUCT(tuple))->relkind);
+ relation->relname, relkind);
ReleaseSysCache(tuple);
relcnt = relalc = 0;
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
+ char relkind;
+
if (!all)
{
- if (!IsSystemClass((Form_pg_class) GETSTRUCT(tuple)))
+ if (!(IsSystemClass((Form_pg_class) GETSTRUCT(tuple)) &&
+ !IsToastClass((Form_pg_class) GETSTRUCT(tuple))))
continue;
}
- if (((Form_pg_class) GETSTRUCT(tuple))->relkind == RELKIND_RELATION)
+ relkind = ((Form_pg_class) GETSTRUCT(tuple))->relkind;
+ if (relkind == RELKIND_RELATION || relkind == RELKIND_TOASTVALUE)
{
old = MemoryContextSwitchTo(private_context);
if (relcnt == 0)
{
StartTransactionCommand();
if (reindex_relation(relids[i], force))
- elog(WARNING, "relation %u was reindexed", relids[i]);
+ elog(NOTICE, "relation %u was reindexed", relids[i]);
CommitTransactionCommand();
}
StartTransactionCommand();