Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit34822e5

Browse files
author
Hiroshi Inoue
committed
Reindex of shared system indexes must be overwrite mode.
1 parent5735c4c commit34822e5

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

‎src/backend/catalog/index.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.140 2001/01/29 00:39:16 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.141 2001/02/23 09:26:14 inoue Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -2087,7 +2087,12 @@ reindex_index(Oid indexId, bool force, bool inplace)
20872087

20882088
#ifndefOLD_FILE_NAMING
20892089
if (!inplace)
2090-
setNewRelfilenode(iRel);
2090+
{
2091+
inplace=IsSharedSystemRelationName(NameStr(iRel->rd_rel->relna
2092+
me));
2093+
if (!inplace)
2094+
setNewRelfilenode(iRel);
2095+
}
20912096
#endif/* OLD_FILE_NAMING */
20922097
/* Obtain exclusive lock on it, just to be sure */
20932098
LockRelation(iRel,AccessExclusiveLock);
@@ -2196,6 +2201,20 @@ reindex_relation(Oid relid, bool force)
21962201
elog(ERROR,"the target relation %u is nailed",relid);
21972202
}
21982203
#endif/* ENABLE_REINDEX_NAILED_RELATIONS */
2204+
/*
2205+
* Shared system indexes must be overwritten because it's
2206+
* impossible to update pg_class tuples of all databases.
2207+
*/
2208+
if (IsSharedSystemRelationName(NameStr(rel->rd_rel->relname)))
2209+
{
2210+
if (IsIgnoringSystemIndexes())
2211+
{
2212+
overwrite= true;
2213+
deactivate_needed= true;
2214+
}
2215+
else
2216+
elog(ERROR,"the target relation %u is shared",relid);
2217+
}
21992218
RelationClose(rel);
22002219
#endif/* OLD_FILE_NAMING */
22012220
old=SetReindexProcessing(true);

‎src/backend/commands/indexcmds.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.44 2001/01/24 19:42:52 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.45 2001/02/23 09:26:14 inoue Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -633,6 +633,7 @@ void
633633
ReindexIndex(constchar*name,boolforce/* currently unused */ )
634634
{
635635
HeapTupletuple;
636+
booloverwrite= false;
636637

637638
/* ----------------
638639
*REINDEX within a transaction block is dangerous, because
@@ -656,7 +657,9 @@ ReindexIndex(const char *name, bool force /* currently unused */ )
656657
#ifdefOLD_FILE_NAMING
657658
if (!reindex_index(tuple->t_data->t_oid,force, false))
658659
#else
659-
if (!reindex_index(tuple->t_data->t_oid,force, false))
660+
if (IsIgnoringSystemIndexes())
661+
overwrite= true;
662+
if (!reindex_index(tuple->t_data->t_oid,force,overwrite))
660663
#endif/* OLD_FILE_NAMING */
661664
elog(NOTICE,"index \"%s\" wasn't reindexed",name);
662665

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp