aboutsummaryrefslogtreecommitdiff
path: root/src/backend/catalog/indexing.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/catalog/indexing.c')
-rw-r--r--src/backend/catalog/indexing.c76
1 files changed, 56 insertions, 20 deletions
diff --git a/src/backend/catalog/indexing.c b/src/backend/catalog/indexing.c
index 1dfd531d345..0815fce3c4b 100644
--- a/src/backend/catalog/indexing.c
+++ b/src/backend/catalog/indexing.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.51 1999/11/22 17:55:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.52 1999/11/24 16:52:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -881,42 +881,77 @@ RewriteOidIndexScan(Relation heapRelation, Oid rewriteId)
HeapTuple
-TypeNameIndexScan(Relation heapRelation, char *typeName)
+ShadowNameIndexScan(Relation heapRelation, char *useName)
{
Relation idesc;
ScanKeyData skey[1];
HeapTuple tuple;
-
+
ScanKeyEntryInitialize(&skey[0],
(bits16) 0x0,
(AttrNumber) 1,
(RegProcedure) F_NAMEEQ,
- PointerGetDatum(typeName));
+ PointerGetDatum(useName));
- idesc = index_openr(TypeNameIndex);
+ idesc = index_openr(ShadowNameIndex);
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
index_close(idesc);
-
return tuple;
}
HeapTuple
-TypeOidIndexScan(Relation heapRelation, Oid typeId)
+ShadowSysidIndexScan(Relation heapRelation, int4 sysId)
{
Relation idesc;
ScanKeyData skey[1];
HeapTuple tuple;
+
+ ScanKeyEntryInitialize(&skey[0],
+ (bits16) 0x0,
+ (AttrNumber) 1,
+ (RegProcedure) F_INT4EQ,
+ Int32GetDatum(sysId));
+
+ idesc = index_openr(ShadowSysidIndex);
+ tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
+
+ index_close(idesc);
+ return tuple;
+}
+
+
+HeapTuple
+StatisticRelidAttnumOpIndexScan(Relation heapRelation,
+ Oid relId,
+ AttrNumber attNum,
+ Oid op)
+{
+ Relation idesc;
+ ScanKeyData skey[3];
+ HeapTuple tuple;
ScanKeyEntryInitialize(&skey[0],
(bits16) 0x0,
(AttrNumber) 1,
(RegProcedure) F_OIDEQ,
- ObjectIdGetDatum(typeId));
+ ObjectIdGetDatum(relId));
- idesc = index_openr(TypeOidIndex);
- tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
+ ScanKeyEntryInitialize(&skey[1],
+ (bits16) 0x0,
+ (AttrNumber) 2,
+ (RegProcedure) F_INT2EQ,
+ Int16GetDatum(attNum));
+
+ ScanKeyEntryInitialize(&skey[2],
+ (bits16) 0x0,
+ (AttrNumber) 3,
+ (RegProcedure) F_OIDEQ,
+ ObjectIdGetDatum(op));
+
+ idesc = index_openr(StatisticRelidAttnumOpIndex);
+ tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 3);
index_close(idesc);
@@ -925,44 +960,45 @@ TypeOidIndexScan(Relation heapRelation, Oid typeId)
HeapTuple
-ShadowNameIndexScan(Relation heapRelation, char *useName)
+TypeNameIndexScan(Relation heapRelation, char *typeName)
{
Relation idesc;
ScanKeyData skey[1];
HeapTuple tuple;
-
+
ScanKeyEntryInitialize(&skey[0],
(bits16) 0x0,
(AttrNumber) 1,
(RegProcedure) F_NAMEEQ,
- PointerGetDatum(useName));
+ PointerGetDatum(typeName));
- idesc = index_openr(ShadowNameIndex);
+ idesc = index_openr(TypeNameIndex);
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
index_close(idesc);
+
return tuple;
}
HeapTuple
-ShadowSysidIndexScan(Relation heapRelation, int4 sysId)
+TypeOidIndexScan(Relation heapRelation, Oid typeId)
{
Relation idesc;
ScanKeyData skey[1];
HeapTuple tuple;
-
+
ScanKeyEntryInitialize(&skey[0],
(bits16) 0x0,
(AttrNumber) 1,
- (RegProcedure) F_INT4EQ,
- Int32GetDatum(sysId));
+ (RegProcedure) F_OIDEQ,
+ ObjectIdGetDatum(typeId));
- idesc = index_openr(ShadowSysidIndex);
+ idesc = index_openr(TypeOidIndex);
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
index_close(idesc);
+
return tuple;
}
-