Reindex of shared system indexes must be overwrite mode.
This commit is contained in:
parent
5735c4cf3d
commit
34822e517a
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.140 2001/01/29 00:39:16 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.141 2001/02/23 09:26:14 inoue Exp $
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* INTERFACE ROUTINES
|
* INTERFACE ROUTINES
|
||||||
@ -2086,8 +2086,13 @@ reindex_index(Oid indexId, bool force, bool inplace)
|
|||||||
elog(ERROR, "reindex_index: can't open index relation");
|
elog(ERROR, "reindex_index: can't open index relation");
|
||||||
|
|
||||||
#ifndef OLD_FILE_NAMING
|
#ifndef OLD_FILE_NAMING
|
||||||
|
if (!inplace)
|
||||||
|
{
|
||||||
|
inplace = IsSharedSystemRelationName(NameStr(iRel->rd_rel->relna
|
||||||
|
me));
|
||||||
if (!inplace)
|
if (!inplace)
|
||||||
setNewRelfilenode(iRel);
|
setNewRelfilenode(iRel);
|
||||||
|
}
|
||||||
#endif /* OLD_FILE_NAMING */
|
#endif /* OLD_FILE_NAMING */
|
||||||
/* Obtain exclusive lock on it, just to be sure */
|
/* Obtain exclusive lock on it, just to be sure */
|
||||||
LockRelation(iRel, AccessExclusiveLock);
|
LockRelation(iRel, AccessExclusiveLock);
|
||||||
@ -2196,6 +2201,20 @@ reindex_relation(Oid relid, bool force)
|
|||||||
elog(ERROR, "the target relation %u is nailed", relid);
|
elog(ERROR, "the target relation %u is nailed", relid);
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
|
#endif /* ENABLE_REINDEX_NAILED_RELATIONS */
|
||||||
|
/*
|
||||||
|
* Shared system indexes must be overwritten because it's
|
||||||
|
* impossible to update pg_class tuples of all databases.
|
||||||
|
*/
|
||||||
|
if (IsSharedSystemRelationName(NameStr(rel->rd_rel->relname)))
|
||||||
|
{
|
||||||
|
if (IsIgnoringSystemIndexes())
|
||||||
|
{
|
||||||
|
overwrite = true;
|
||||||
|
deactivate_needed = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
elog(ERROR, "the target relation %u is shared", relid);
|
||||||
|
}
|
||||||
RelationClose(rel);
|
RelationClose(rel);
|
||||||
#endif /* OLD_FILE_NAMING */
|
#endif /* OLD_FILE_NAMING */
|
||||||
old = SetReindexProcessing(true);
|
old = SetReindexProcessing(true);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.44 2001/01/24 19:42:52 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.45 2001/02/23 09:26:14 inoue Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -633,6 +633,7 @@ void
|
|||||||
ReindexIndex(const char *name, bool force /* currently unused */ )
|
ReindexIndex(const char *name, bool force /* currently unused */ )
|
||||||
{
|
{
|
||||||
HeapTuple tuple;
|
HeapTuple tuple;
|
||||||
|
bool overwrite = false;
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* REINDEX within a transaction block is dangerous, because
|
* REINDEX within a transaction block is dangerous, because
|
||||||
@ -656,7 +657,9 @@ ReindexIndex(const char *name, bool force /* currently unused */ )
|
|||||||
#ifdef OLD_FILE_NAMING
|
#ifdef OLD_FILE_NAMING
|
||||||
if (!reindex_index(tuple->t_data->t_oid, force, false))
|
if (!reindex_index(tuple->t_data->t_oid, force, false))
|
||||||
#else
|
#else
|
||||||
if (!reindex_index(tuple->t_data->t_oid, force, false))
|
if (IsIgnoringSystemIndexes())
|
||||||
|
overwrite = true;
|
||||||
|
if (!reindex_index(tuple->t_data->t_oid, force, overwrite))
|
||||||
#endif /* OLD_FILE_NAMING */
|
#endif /* OLD_FILE_NAMING */
|
||||||
elog(NOTICE, "index \"%s\" wasn't reindexed", name);
|
elog(NOTICE, "index \"%s\" wasn't reindexed", name);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user