1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-27 07:42:10 +03:00

Repair some REINDEX problems per recent discussions. The relcache is

now able to cope with assigning new relfilenode values to nailed-in-cache
indexes, so they can be reindexed using the fully crash-safe method.  This
leaves only shared system indexes as special cases.  Remove the 'index
deactivation' code, since it provides no useful protection in the shared-
index case.  Require reindexing of shared indexes to be done in standalone
mode, but remove other restrictions on REINDEX.  -P (IgnoreSystemIndexes)
now prevents using indexes for lookups, but does not disable index updates.
It is therefore safe to allow from PGOPTIONS.  Upshot: reindexing system catalogs
can be done without a standalone backend for all cases except
shared catalogs.
This commit is contained in:
Tom Lane
2003-09-24 18:54:02 +00:00
parent 5f78c6a886
commit a56a016ceb
22 changed files with 621 additions and 635 deletions

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.34 2003/09/10 19:59:23 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.35 2003/09/24 18:54:01 tgl Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
@@ -1095,24 +1095,25 @@ DropCast(DropCastStmt *stmt)
void
DropCastById(Oid castOid)
{
Relation relation,
index;
Relation relation;
ScanKeyData scankey;
IndexScanDesc scan;
SysScanDesc scan;
HeapTuple tuple;
relation = heap_openr(CastRelationName, RowExclusiveLock);
index = index_openr(CastOidIndex);
ScanKeyEntryInitialize(&scankey, 0x0,
1, F_OIDEQ, ObjectIdGetDatum(castOid));
scan = index_beginscan(relation, index, SnapshotNow, 1, &scankey);
tuple = index_getnext(scan, ForwardScanDirection);
ObjectIdAttributeNumber,
F_OIDEQ,
ObjectIdGetDatum(castOid));
scan = systable_beginscan(relation, CastOidIndex, true,
SnapshotNow, 1, &scankey);
tuple = systable_getnext(scan);
if (!HeapTupleIsValid(tuple))
elog(ERROR, "could not find tuple for cast %u", castOid);
simple_heap_delete(relation, &tuple->t_self);
index_endscan(scan);
index_close(index);
systable_endscan(scan);
heap_close(relation, RowExclusiveLock);
}