mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Completion of project to use fixed OIDs for all system catalogs and
indexes. Replace all heap_openr and index_openr calls by heap_open and index_open. Remove runtime lookups of catalog OID numbers in various places. Remove relcache's support for looking up system catalogs by name. Bulky but mostly very boring patch ...
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.46 2005/03/29 00:16:51 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.47 2005/04/14 20:03:23 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* many of the old access method routines have been turned into
|
||||
@@ -162,7 +162,7 @@ IndexScanEnd(IndexScanDesc scan)
|
||||
* systable_beginscan --- set up for heap-or-index scan
|
||||
*
|
||||
* rel: catalog to scan, already opened and suitably locked
|
||||
* indexRelname: name of index to conditionally use
|
||||
* indexId: OID of index to conditionally use
|
||||
* indexOK: if false, forces a heap scan (see notes below)
|
||||
* snapshot: time qual to use (usually should be SnapshotNow)
|
||||
* nkeys, key: scan keys
|
||||
@@ -179,7 +179,7 @@ IndexScanEnd(IndexScanDesc scan)
|
||||
*/
|
||||
SysScanDesc
|
||||
systable_beginscan(Relation heapRelation,
|
||||
const char *indexRelname,
|
||||
Oid indexId,
|
||||
bool indexOK,
|
||||
Snapshot snapshot,
|
||||
int nkeys, ScanKey key)
|
||||
@@ -187,18 +187,10 @@ systable_beginscan(Relation heapRelation,
|
||||
SysScanDesc sysscan;
|
||||
Relation irel;
|
||||
|
||||
if (indexOK && !IsIgnoringSystemIndexes())
|
||||
{
|
||||
/* We assume it's a system index, so index_openr is OK */
|
||||
irel = index_openr(indexRelname);
|
||||
|
||||
if (ReindexIsProcessingIndex(RelationGetRelid(irel)))
|
||||
{
|
||||
/* oops, can't use index that's being rebuilt */
|
||||
index_close(irel);
|
||||
irel = NULL;
|
||||
}
|
||||
}
|
||||
if (indexOK &&
|
||||
!IsIgnoringSystemIndexes() &&
|
||||
!ReindexIsProcessingIndex(indexId))
|
||||
irel = index_open(indexId);
|
||||
else
|
||||
irel = NULL;
|
||||
|
||||
|
||||
@@ -8,12 +8,11 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.79 2005/03/27 23:52:59 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.80 2005/04/14 20:03:23 tgl Exp $
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
* index_open - open an index relation by relation OID
|
||||
* index_openrv - open an index relation specified by a RangeVar
|
||||
* index_openr - open a system index relation by name
|
||||
* index_close - close an index relation
|
||||
* index_beginscan - start a scan of an index with amgettuple
|
||||
* index_beginscan_multi - start a scan of an index with amgetmulti
|
||||
@@ -172,31 +171,6 @@ index_openrv(const RangeVar *relation)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* index_openr - open a system index relation specified by name.
|
||||
*
|
||||
* As above, but the relation is specified by an unqualified name;
|
||||
* it is assumed to live in the system catalog namespace.
|
||||
* ----------------
|
||||
*/
|
||||
Relation
|
||||
index_openr(const char *sysRelationName)
|
||||
{
|
||||
Relation r;
|
||||
|
||||
r = relation_openr(sysRelationName, NoLock);
|
||||
|
||||
if (r->rd_rel->relkind != RELKIND_INDEX)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("\"%s\" is not an index",
|
||||
RelationGetRelationName(r))));
|
||||
|
||||
pgstat_initstats(&r->pgstat_info, r);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* index_close - close a index relation
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user