aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/heap/heapam.c79
-rw-r--r--src/backend/access/index/genam.c22
-rw-r--r--src/backend/access/index/indexam.c28
3 files changed, 9 insertions, 120 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 9876f8b695b..605ed629426 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -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
@@ -503,15 +501,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
* identifies a rel that has been dropped and recreated since the
@@ -534,37 +523,6 @@ relation_openrv(const RangeVar *relation, LOCKMODE 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
*
* If lockmode is not "NoLock", we first release the specified lock.
@@ -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
diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c
index 74f5bb7dd6f..d2504de2190 100644
--- a/src/backend/access/index/genam.c
+++ b/src/backend/access/index/genam.c
@@ -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;
diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c
index f6f4a065cfb..e2f8078b235 100644
--- a/src/backend/access/index/indexam.c
+++ b/src/backend/access/index/indexam.c
@@ -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
@@ -173,31 +172,6 @@ index_openrv(const RangeVar *relation)
}
/* ----------------
- * 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
*
* presently the relcache routines do all the work we need