diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-09-24 18:54:02 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-09-24 18:54:02 +0000 |
commit | a56a016ceb612cdee1ddc5990682f36d541e5b07 (patch) | |
tree | c496319424e0445562dd42ee7229e6d87567996f /src/backend/commands/functioncmds.c | |
parent | 5f78c6a886a22209dee62de0c13edd6a68453011 (diff) | |
download | postgresql-a56a016ceb612cdee1ddc5990682f36d541e5b07.tar.gz postgresql-a56a016ceb612cdee1ddc5990682f36d541e5b07.zip |
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.
Diffstat (limited to 'src/backend/commands/functioncmds.c')
-rw-r--r-- | src/backend/commands/functioncmds.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index ea5ba103131..328643c171e 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -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); } |