mirror of
https://github.com/postgres/postgres.git
synced 2025-07-21 16:02:15 +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,17 +8,15 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.186 2005/03/28 01:50:32 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.187 2005/04/14 20:03:22 tgl Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
* relation_open - open any relation by relation OID
|
||||
* relation_openrv - open any relation specified by a RangeVar
|
||||
* relation_openr - open a system relation by name
|
||||
* relation_close - close any relation
|
||||
* heap_open - open a heap relation by relation OID
|
||||
* heap_openrv - open a heap relation specified by a RangeVar
|
||||
* heap_openr - open a system heap relation by name
|
||||
* heap_close - (now just a macro for relation_close)
|
||||
* heap_beginscan - begin relation scan
|
||||
* heap_rescan - restart a relation scan
|
||||
@ -502,15 +500,6 @@ relation_openrv(const RangeVar *relation, LOCKMODE lockmode)
|
||||
{
|
||||
Oid relOid;
|
||||
|
||||
/*
|
||||
* In bootstrap mode, don't do any namespace processing.
|
||||
*/
|
||||
if (IsBootstrapProcessingMode())
|
||||
{
|
||||
Assert(relation->schemaname == NULL);
|
||||
return relation_openr(relation->relname, lockmode);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for shared-cache-inval messages before trying to open the
|
||||
* relation. This is needed to cover the case where the name
|
||||
@ -533,37 +522,6 @@ relation_openrv(const RangeVar *relation, LOCKMODE lockmode)
|
||||
return relation_open(relOid, lockmode);
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* relation_openr - open a system 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
|
||||
relation_openr(const char *sysRelationName, LOCKMODE lockmode)
|
||||
{
|
||||
Relation r;
|
||||
|
||||
Assert(lockmode >= NoLock && lockmode < MAX_LOCKMODES);
|
||||
|
||||
/*
|
||||
* We assume we should not need to worry about the rel's OID changing,
|
||||
* hence no need for AcceptInvalidationMessages here.
|
||||
*/
|
||||
|
||||
/* The relcache does all the real work... */
|
||||
r = RelationSysNameGetRelation(sysRelationName);
|
||||
|
||||
if (!RelationIsValid(r))
|
||||
elog(ERROR, "could not open relation \"%s\"", sysRelationName);
|
||||
|
||||
if (lockmode != NoLock)
|
||||
LockRelation(r, lockmode);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* relation_close - close any relation
|
||||
*
|
||||
@ -657,41 +615,6 @@ heap_openrv(const RangeVar *relation, LOCKMODE lockmode)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* heap_openr - open a system heap 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
|
||||
heap_openr(const char *sysRelationName, LOCKMODE lockmode)
|
||||
{
|
||||
Relation r;
|
||||
|
||||
r = relation_openr(sysRelationName, lockmode);
|
||||
|
||||
if (r->rd_rel->relkind == RELKIND_INDEX)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("\"%s\" is an index",
|
||||
RelationGetRelationName(r))));
|
||||
else if (r->rd_rel->relkind == RELKIND_SPECIAL)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("\"%s\" is a special relation",
|
||||
RelationGetRelationName(r))));
|
||||
else if (r->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||
errmsg("\"%s\" is a composite type",
|
||||
RelationGetRelationName(r))));
|
||||
|
||||
pgstat_initstats(&r->pgstat_info, r);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
/* ----------------
|
||||
* heap_beginscan - begin relation scan
|
||||
|
Reference in New Issue
Block a user