Clean out another pocket of functions called via nonspecific function
pointers, namely the catcache tuple fetch routines. Also get rid of the unused and possibly confusing 'size' field in struct cachedesc. Since it doesn't allow for variable-length fields, anyone who actually trusted it would likely be making a mistake...
This commit is contained in:
parent
1652d43358
commit
9cf80f2f55
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.115 2000/06/15 03:32:02 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.116 2000/06/17 04:56:36 tgl Exp $
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* INTERFACE ROUTINES
|
* INTERFACE ROUTINES
|
||||||
@ -479,13 +479,13 @@ UpdateRelationRelation(Relation indexRelation, char *temp_relname)
|
|||||||
|
|
||||||
/* XXX Natts_pg_class_fixed is a hack - see pg_class.h */
|
/* XXX Natts_pg_class_fixed is a hack - see pg_class.h */
|
||||||
tuple = heap_addheader(Natts_pg_class_fixed,
|
tuple = heap_addheader(Natts_pg_class_fixed,
|
||||||
sizeof(*indexRelation->rd_rel),
|
CLASS_TUPLE_SIZE,
|
||||||
(char *) indexRelation->rd_rel);
|
(char *) indexRelation->rd_rel);
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* the new tuple must have the same oid as the relcache entry for the
|
* the new tuple must have the same oid as the relcache entry for the
|
||||||
* index. sure would be embarassing to do this sort of thing in polite
|
* index. sure would be embarrassing to do this sort of thing in
|
||||||
* company.
|
* polite company.
|
||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
tuple->t_data->t_oid = RelationGetRelid(indexRelation);
|
tuple->t_data->t_oid = RelationGetRelid(indexRelation);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.65 2000/06/15 03:32:02 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.66 2000/06/17 04:56:39 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -293,7 +293,8 @@ CatalogIndexFetchTuple(Relation heapRelation,
|
|||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
AggregateNameTypeIndexScan(Relation heapRelation, char *aggName, Oid aggType)
|
AggregateNameTypeIndexScan(Relation heapRelation,
|
||||||
|
Datum aggName, Datum aggType)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[2];
|
ScanKeyData skey[2];
|
||||||
@ -303,13 +304,13 @@ AggregateNameTypeIndexScan(Relation heapRelation, char *aggName, Oid aggType)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
PointerGetDatum(aggName));
|
aggName);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[1],
|
ScanKeyEntryInitialize(&skey[1],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 2,
|
(AttrNumber) 2,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(aggType));
|
aggType);
|
||||||
|
|
||||||
idesc = index_openr(AggregateNameTypeIndex);
|
idesc = index_openr(AggregateNameTypeIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
|
||||||
@ -320,7 +321,7 @@ AggregateNameTypeIndexScan(Relation heapRelation, char *aggName, Oid aggType)
|
|||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
AmNameIndexScan(Relation heapRelation, char *amName)
|
AmNameIndexScan(Relation heapRelation, Datum amName)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -330,7 +331,7 @@ AmNameIndexScan(Relation heapRelation, char *amName)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
PointerGetDatum(amName));
|
amName);
|
||||||
|
|
||||||
idesc = index_openr(AmNameIndex);
|
idesc = index_openr(AmNameIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
@ -342,9 +343,9 @@ AmNameIndexScan(Relation heapRelation, char *amName)
|
|||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
AccessMethodOpidIndexScan(Relation heapRelation,
|
AccessMethodOpidIndexScan(Relation heapRelation,
|
||||||
Oid claid,
|
Datum claid,
|
||||||
Oid opopr,
|
Datum opopr,
|
||||||
Oid opid)
|
Datum opid)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[3];
|
ScanKeyData skey[3];
|
||||||
@ -354,33 +355,32 @@ AccessMethodOpidIndexScan(Relation heapRelation,
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(claid));
|
claid);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[1],
|
ScanKeyEntryInitialize(&skey[1],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 2,
|
(AttrNumber) 2,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(opopr));
|
opopr);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[2],
|
ScanKeyEntryInitialize(&skey[2],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 3,
|
(AttrNumber) 3,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(opid));
|
opid);
|
||||||
|
|
||||||
idesc = index_openr(AccessMethodOpidIndex);
|
idesc = index_openr(AccessMethodOpidIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 3);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 3);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
AccessMethodStrategyIndexScan(Relation heapRelation,
|
AccessMethodStrategyIndexScan(Relation heapRelation,
|
||||||
Oid opid,
|
Datum opid,
|
||||||
Oid claid,
|
Datum claid,
|
||||||
int2 opstrategy)
|
Datum opstrategy)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[3];
|
ScanKeyData skey[3];
|
||||||
@ -390,33 +390,32 @@ AccessMethodStrategyIndexScan(Relation heapRelation,
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(opid));
|
opid);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[1],
|
ScanKeyEntryInitialize(&skey[1],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 2,
|
(AttrNumber) 2,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(claid));
|
claid);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[2],
|
ScanKeyEntryInitialize(&skey[2],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 3,
|
(AttrNumber) 3,
|
||||||
(RegProcedure) F_INT2EQ,
|
(RegProcedure) F_INT2EQ,
|
||||||
Int16GetDatum(opstrategy));
|
opstrategy);
|
||||||
|
|
||||||
idesc = index_openr(AccessMethodStrategyIndex);
|
idesc = index_openr(AccessMethodStrategyIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 3);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 3);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
AttributeRelidNameIndexScan(Relation heapRelation,
|
AttributeRelidNameIndexScan(Relation heapRelation,
|
||||||
Oid relid,
|
Datum relid,
|
||||||
char *attname)
|
Datum attname)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[2];
|
ScanKeyData skey[2];
|
||||||
@ -426,27 +425,26 @@ AttributeRelidNameIndexScan(Relation heapRelation,
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(relid));
|
relid);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[1],
|
ScanKeyEntryInitialize(&skey[1],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 2,
|
(AttrNumber) 2,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
NameGetDatum(attname));
|
attname);
|
||||||
|
|
||||||
idesc = index_openr(AttributeRelidNameIndex);
|
idesc = index_openr(AttributeRelidNameIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
AttributeRelidNumIndexScan(Relation heapRelation,
|
AttributeRelidNumIndexScan(Relation heapRelation,
|
||||||
Oid relid,
|
Datum relid,
|
||||||
AttrNumber attnum)
|
Datum attnum)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[2];
|
ScanKeyData skey[2];
|
||||||
@ -456,25 +454,24 @@ AttributeRelidNumIndexScan(Relation heapRelation,
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(relid));
|
relid);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[1],
|
ScanKeyEntryInitialize(&skey[1],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 2,
|
(AttrNumber) 2,
|
||||||
(RegProcedure) F_INT2EQ,
|
(RegProcedure) F_INT2EQ,
|
||||||
Int16GetDatum(attnum));
|
attnum);
|
||||||
|
|
||||||
idesc = index_openr(AttributeRelidNumIndex);
|
idesc = index_openr(AttributeRelidNumIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
OpclassDeftypeIndexScan(Relation heapRelation, Oid defType)
|
OpclassDeftypeIndexScan(Relation heapRelation, Datum defType)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -484,19 +481,18 @@ OpclassDeftypeIndexScan(Relation heapRelation, Oid defType)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(defType));
|
defType);
|
||||||
|
|
||||||
idesc = index_openr(OpclassDeftypeIndex);
|
idesc = index_openr(OpclassDeftypeIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
OpclassNameIndexScan(Relation heapRelation, char *opcName)
|
OpclassNameIndexScan(Relation heapRelation, Datum opcName)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -506,7 +502,7 @@ OpclassNameIndexScan(Relation heapRelation, char *opcName)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
PointerGetDatum(opcName));
|
opcName);
|
||||||
|
|
||||||
idesc = index_openr(OpclassNameIndex);
|
idesc = index_openr(OpclassNameIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
@ -517,7 +513,7 @@ OpclassNameIndexScan(Relation heapRelation, char *opcName)
|
|||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
GroupNameIndexScan(Relation heapRelation, char *groName)
|
GroupNameIndexScan(Relation heapRelation, Datum groName)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -527,7 +523,7 @@ GroupNameIndexScan(Relation heapRelation, char *groName)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
PointerGetDatum(groName));
|
groName);
|
||||||
|
|
||||||
idesc = index_openr(GroupNameIndex);
|
idesc = index_openr(GroupNameIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
@ -538,7 +534,7 @@ GroupNameIndexScan(Relation heapRelation, char *groName)
|
|||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
GroupSysidIndexScan(Relation heapRelation, int4 sysId)
|
GroupSysidIndexScan(Relation heapRelation, Datum sysId)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -548,7 +544,7 @@ GroupSysidIndexScan(Relation heapRelation, int4 sysId)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_INT4EQ,
|
(RegProcedure) F_INT4EQ,
|
||||||
Int32GetDatum(sysId));
|
sysId);
|
||||||
|
|
||||||
idesc = index_openr(GroupSysidIndex);
|
idesc = index_openr(GroupSysidIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
@ -559,7 +555,7 @@ GroupSysidIndexScan(Relation heapRelation, int4 sysId)
|
|||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
IndexRelidIndexScan(Relation heapRelation, Oid relid)
|
IndexRelidIndexScan(Relation heapRelation, Datum relid)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -569,21 +565,20 @@ IndexRelidIndexScan(Relation heapRelation, Oid relid)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(relid));
|
relid);
|
||||||
|
|
||||||
idesc = index_openr(IndexRelidIndex);
|
idesc = index_openr(IndexRelidIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
InheritsRelidSeqnoIndexScan(Relation heapRelation,
|
InheritsRelidSeqnoIndexScan(Relation heapRelation,
|
||||||
Oid relid,
|
Datum relid,
|
||||||
int4 seqno)
|
Datum seqno)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[2];
|
ScanKeyData skey[2];
|
||||||
@ -593,25 +588,24 @@ InheritsRelidSeqnoIndexScan(Relation heapRelation,
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(relid));
|
relid);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[1],
|
ScanKeyEntryInitialize(&skey[1],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 2,
|
(AttrNumber) 2,
|
||||||
(RegProcedure) F_INT4EQ,
|
(RegProcedure) F_INT4EQ,
|
||||||
Int32GetDatum(seqno));
|
seqno);
|
||||||
|
|
||||||
idesc = index_openr(InheritsRelidSeqnoIndex);
|
idesc = index_openr(InheritsRelidSeqnoIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
LanguageNameIndexScan(Relation heapRelation, char *lanName)
|
LanguageNameIndexScan(Relation heapRelation, Datum lanName)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -621,7 +615,7 @@ LanguageNameIndexScan(Relation heapRelation, char *lanName)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
PointerGetDatum(lanName));
|
lanName);
|
||||||
|
|
||||||
idesc = index_openr(LanguageNameIndex);
|
idesc = index_openr(LanguageNameIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
@ -632,7 +626,7 @@ LanguageNameIndexScan(Relation heapRelation, char *lanName)
|
|||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
LanguageOidIndexScan(Relation heapRelation, Oid lanId)
|
LanguageOidIndexScan(Relation heapRelation, Datum lanId)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -642,19 +636,19 @@ LanguageOidIndexScan(Relation heapRelation, Oid lanId)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(lanId));
|
lanId);
|
||||||
|
|
||||||
idesc = index_openr(LanguageOidIndex);
|
idesc = index_openr(LanguageOidIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
ListenerPidRelnameIndexScan(Relation heapRelation, int4 pid, char *relName)
|
ListenerPidRelnameIndexScan(Relation heapRelation,
|
||||||
|
Datum pid, Datum relName)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[2];
|
ScanKeyData skey[2];
|
||||||
@ -664,13 +658,13 @@ ListenerPidRelnameIndexScan(Relation heapRelation, int4 pid, char *relName)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_INT4EQ,
|
(RegProcedure) F_INT4EQ,
|
||||||
Int32GetDatum(pid));
|
pid);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[1],
|
ScanKeyEntryInitialize(&skey[1],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 2,
|
(AttrNumber) 2,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
PointerGetDatum(relName));
|
relName);
|
||||||
|
|
||||||
idesc = index_openr(ListenerPidRelnameIndex);
|
idesc = index_openr(ListenerPidRelnameIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
|
||||||
@ -682,10 +676,10 @@ ListenerPidRelnameIndexScan(Relation heapRelation, int4 pid, char *relName)
|
|||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
OperatorNameIndexScan(Relation heapRelation,
|
OperatorNameIndexScan(Relation heapRelation,
|
||||||
char *oprName,
|
Datum oprName,
|
||||||
Oid oprLeft,
|
Datum oprLeft,
|
||||||
Oid oprRight,
|
Datum oprRight,
|
||||||
char oprKind)
|
Datum oprKind)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[4];
|
ScanKeyData skey[4];
|
||||||
@ -695,37 +689,36 @@ OperatorNameIndexScan(Relation heapRelation,
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
PointerGetDatum(oprName));
|
oprName);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[1],
|
ScanKeyEntryInitialize(&skey[1],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 2,
|
(AttrNumber) 2,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(oprLeft));
|
oprLeft);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[2],
|
ScanKeyEntryInitialize(&skey[2],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 3,
|
(AttrNumber) 3,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(oprRight));
|
oprRight);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[3],
|
ScanKeyEntryInitialize(&skey[3],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 4,
|
(AttrNumber) 4,
|
||||||
(RegProcedure) F_CHAREQ,
|
(RegProcedure) F_CHAREQ,
|
||||||
CharGetDatum(oprKind));
|
oprKind);
|
||||||
|
|
||||||
idesc = index_openr(OperatorNameIndex);
|
idesc = index_openr(OperatorNameIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 4);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 4);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
OperatorOidIndexScan(Relation heapRelation, Oid oprId)
|
OperatorOidIndexScan(Relation heapRelation, Datum oprId)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -735,22 +728,21 @@ OperatorOidIndexScan(Relation heapRelation, Oid oprId)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(oprId));
|
oprId);
|
||||||
|
|
||||||
idesc = index_openr(OperatorOidIndex);
|
idesc = index_openr(OperatorOidIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
ProcedureNameIndexScan(Relation heapRelation,
|
ProcedureNameIndexScan(Relation heapRelation,
|
||||||
char *procName,
|
Datum procName,
|
||||||
int2 nargs,
|
Datum nargs,
|
||||||
Oid *argTypes)
|
Datum argTypes)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[3];
|
ScanKeyData skey[3];
|
||||||
@ -760,31 +752,30 @@ ProcedureNameIndexScan(Relation heapRelation,
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
PointerGetDatum(procName));
|
procName);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[1],
|
ScanKeyEntryInitialize(&skey[1],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 2,
|
(AttrNumber) 2,
|
||||||
(RegProcedure) F_INT2EQ,
|
(RegProcedure) F_INT2EQ,
|
||||||
Int16GetDatum(nargs));
|
nargs);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[2],
|
ScanKeyEntryInitialize(&skey[2],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 3,
|
(AttrNumber) 3,
|
||||||
(RegProcedure) F_OIDVECTOREQ,
|
(RegProcedure) F_OIDVECTOREQ,
|
||||||
PointerGetDatum(argTypes));
|
argTypes);
|
||||||
|
|
||||||
idesc = index_openr(ProcedureNameIndex);
|
idesc = index_openr(ProcedureNameIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 3);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 3);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
ProcedureOidIndexScan(Relation heapRelation, Oid procId)
|
ProcedureOidIndexScan(Relation heapRelation, Datum procId)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -794,19 +785,18 @@ ProcedureOidIndexScan(Relation heapRelation, Oid procId)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(procId));
|
procId);
|
||||||
|
|
||||||
idesc = index_openr(ProcedureOidIndex);
|
idesc = index_openr(ProcedureOidIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
ClassNameIndexScan(Relation heapRelation, char *relName)
|
ClassNameIndexScan(Relation heapRelation, Datum relName)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -816,7 +806,7 @@ ClassNameIndexScan(Relation heapRelation, char *relName)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
PointerGetDatum(relName));
|
relName);
|
||||||
|
|
||||||
idesc = index_openr(ClassNameIndex);
|
idesc = index_openr(ClassNameIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
@ -827,7 +817,7 @@ ClassNameIndexScan(Relation heapRelation, char *relName)
|
|||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
ClassOidIndexScan(Relation heapRelation, Oid relId)
|
ClassOidIndexScan(Relation heapRelation, Datum relId)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -837,19 +827,18 @@ ClassOidIndexScan(Relation heapRelation, Oid relId)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(relId));
|
relId);
|
||||||
|
|
||||||
idesc = index_openr(ClassOidIndex);
|
idesc = index_openr(ClassOidIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
RewriteRulenameIndexScan(Relation heapRelation, char *ruleName)
|
RewriteRulenameIndexScan(Relation heapRelation, Datum ruleName)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -859,7 +848,7 @@ RewriteRulenameIndexScan(Relation heapRelation, char *ruleName)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
PointerGetDatum(ruleName));
|
ruleName);
|
||||||
|
|
||||||
idesc = index_openr(RewriteRulenameIndex);
|
idesc = index_openr(RewriteRulenameIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
@ -870,7 +859,7 @@ RewriteRulenameIndexScan(Relation heapRelation, char *ruleName)
|
|||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
RewriteOidIndexScan(Relation heapRelation, Oid rewriteId)
|
RewriteOidIndexScan(Relation heapRelation, Datum rewriteId)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -880,19 +869,18 @@ RewriteOidIndexScan(Relation heapRelation, Oid rewriteId)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(rewriteId));
|
rewriteId);
|
||||||
|
|
||||||
idesc = index_openr(RewriteOidIndex);
|
idesc = index_openr(RewriteOidIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
ShadowNameIndexScan(Relation heapRelation, char *useName)
|
ShadowNameIndexScan(Relation heapRelation, Datum useName)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -902,7 +890,7 @@ ShadowNameIndexScan(Relation heapRelation, char *useName)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
PointerGetDatum(useName));
|
useName);
|
||||||
|
|
||||||
idesc = index_openr(ShadowNameIndex);
|
idesc = index_openr(ShadowNameIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
@ -913,7 +901,7 @@ ShadowNameIndexScan(Relation heapRelation, char *useName)
|
|||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
ShadowSysidIndexScan(Relation heapRelation, int4 sysId)
|
ShadowSysidIndexScan(Relation heapRelation, Datum sysId)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -923,7 +911,7 @@ ShadowSysidIndexScan(Relation heapRelation, int4 sysId)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_INT4EQ,
|
(RegProcedure) F_INT4EQ,
|
||||||
Int32GetDatum(sysId));
|
sysId);
|
||||||
|
|
||||||
idesc = index_openr(ShadowSysidIndex);
|
idesc = index_openr(ShadowSysidIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
@ -935,8 +923,8 @@ ShadowSysidIndexScan(Relation heapRelation, int4 sysId)
|
|||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
StatisticRelidAttnumIndexScan(Relation heapRelation,
|
StatisticRelidAttnumIndexScan(Relation heapRelation,
|
||||||
Oid relId,
|
Datum relId,
|
||||||
AttrNumber attNum)
|
Datum attNum)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[2];
|
ScanKeyData skey[2];
|
||||||
@ -946,25 +934,24 @@ StatisticRelidAttnumIndexScan(Relation heapRelation,
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(relId));
|
relId);
|
||||||
|
|
||||||
ScanKeyEntryInitialize(&skey[1],
|
ScanKeyEntryInitialize(&skey[1],
|
||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 2,
|
(AttrNumber) 2,
|
||||||
(RegProcedure) F_INT2EQ,
|
(RegProcedure) F_INT2EQ,
|
||||||
Int16GetDatum(attNum));
|
attNum);
|
||||||
|
|
||||||
idesc = index_openr(StatisticRelidAttnumIndex);
|
idesc = index_openr(StatisticRelidAttnumIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 2);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
TypeNameIndexScan(Relation heapRelation, char *typeName)
|
TypeNameIndexScan(Relation heapRelation, Datum typeName)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -974,19 +961,18 @@ TypeNameIndexScan(Relation heapRelation, char *typeName)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_NAMEEQ,
|
(RegProcedure) F_NAMEEQ,
|
||||||
PointerGetDatum(typeName));
|
typeName);
|
||||||
|
|
||||||
idesc = index_openr(TypeNameIndex);
|
idesc = index_openr(TypeNameIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HeapTuple
|
HeapTuple
|
||||||
TypeOidIndexScan(Relation heapRelation, Oid typeId)
|
TypeOidIndexScan(Relation heapRelation, Datum typeId)
|
||||||
{
|
{
|
||||||
Relation idesc;
|
Relation idesc;
|
||||||
ScanKeyData skey[1];
|
ScanKeyData skey[1];
|
||||||
@ -996,12 +982,11 @@ TypeOidIndexScan(Relation heapRelation, Oid typeId)
|
|||||||
(bits16) 0x0,
|
(bits16) 0x0,
|
||||||
(AttrNumber) 1,
|
(AttrNumber) 1,
|
||||||
(RegProcedure) F_OIDEQ,
|
(RegProcedure) F_OIDEQ,
|
||||||
ObjectIdGetDatum(typeId));
|
typeId);
|
||||||
|
|
||||||
idesc = index_openr(TypeOidIndex);
|
idesc = index_openr(TypeOidIndex);
|
||||||
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
tuple = CatalogIndexFetchTuple(heapRelation, idesc, skey, 1);
|
||||||
|
|
||||||
index_close(idesc);
|
index_close(idesc);
|
||||||
|
|
||||||
return tuple;
|
return tuple;
|
||||||
}
|
}
|
||||||
|
64
src/backend/utils/cache/catcache.c
vendored
64
src/backend/utils/cache/catcache.c
vendored
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.65 2000/06/05 07:28:53 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.66 2000/06/17 04:56:32 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -29,12 +29,12 @@
|
|||||||
#include "utils/syscache.h"
|
#include "utils/syscache.h"
|
||||||
|
|
||||||
static void CatCacheRemoveCTup(CatCache *cache, Dlelem *e);
|
static void CatCacheRemoveCTup(CatCache *cache, Dlelem *e);
|
||||||
static Index CatalogCacheComputeHashIndex(struct catcache * cacheInP);
|
static Index CatalogCacheComputeHashIndex(CatCache *cacheInP);
|
||||||
static Index CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
|
static Index CatalogCacheComputeTupleHashIndex(CatCache *cacheInOutP,
|
||||||
Relation relation,
|
Relation relation,
|
||||||
HeapTuple tuple);
|
HeapTuple tuple);
|
||||||
static void CatalogCacheInitializeCache(struct catcache * cache,
|
static void CatalogCacheInitializeCache(CatCache *cache,
|
||||||
Relation relation);
|
Relation relation);
|
||||||
static Datum cc_hashname(PG_FUNCTION_ARGS);
|
static Datum cc_hashname(PG_FUNCTION_ARGS);
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
@ -168,7 +168,7 @@ do { \
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CatalogCacheInitializeCache(struct catcache * cache,
|
CatalogCacheInitializeCache(CatCache * cache,
|
||||||
Relation relation)
|
Relation relation)
|
||||||
{
|
{
|
||||||
MemoryContext oldcxt;
|
MemoryContext oldcxt;
|
||||||
@ -196,7 +196,7 @@ CatalogCacheInitializeCache(struct catcache * cache,
|
|||||||
*/
|
*/
|
||||||
if (!RelationIsValid(relation))
|
if (!RelationIsValid(relation))
|
||||||
{
|
{
|
||||||
struct catcache *cp;
|
CatCache *cp;
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* scan the caches to see if any other cache has opened the relation
|
* scan the caches to see if any other cache has opened the relation
|
||||||
@ -307,7 +307,7 @@ CatalogCacheInitializeCache(struct catcache * cache,
|
|||||||
* --------------------------------
|
* --------------------------------
|
||||||
*/
|
*/
|
||||||
static Index
|
static Index
|
||||||
CatalogCacheComputeHashIndex(struct catcache * cacheInP)
|
CatalogCacheComputeHashIndex(CatCache * cacheInP)
|
||||||
{
|
{
|
||||||
uint32 hashIndex = 0;
|
uint32 hashIndex = 0;
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ CatalogCacheComputeHashIndex(struct catcache * cacheInP)
|
|||||||
* --------------------------------
|
* --------------------------------
|
||||||
*/
|
*/
|
||||||
static Index
|
static Index
|
||||||
CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
|
CatalogCacheComputeTupleHashIndex(CatCache * cacheInOutP,
|
||||||
Relation relation,
|
Relation relation,
|
||||||
HeapTuple tuple)
|
HeapTuple tuple)
|
||||||
{
|
{
|
||||||
@ -543,7 +543,7 @@ void
|
|||||||
ResetSystemCache()
|
ResetSystemCache()
|
||||||
{
|
{
|
||||||
MemoryContext oldcxt;
|
MemoryContext oldcxt;
|
||||||
struct catcache *cache;
|
CatCache *cache;
|
||||||
|
|
||||||
CACHE1_elog(DEBUG, "ResetSystemCache called");
|
CACHE1_elog(DEBUG, "ResetSystemCache called");
|
||||||
|
|
||||||
@ -632,7 +632,7 @@ SystemCacheRelationFlushed(Oid relId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------
|
/* --------------------------------
|
||||||
* InitIndexedSysCache
|
* InitSysCache
|
||||||
*
|
*
|
||||||
* This allocates and initializes a cache for a system catalog relation.
|
* This allocates and initializes a cache for a system catalog relation.
|
||||||
* Actually, the cache is only partially initialized to avoid opening the
|
* Actually, the cache is only partially initialized to avoid opening the
|
||||||
@ -666,7 +666,7 @@ InitSysCache(char *relname,
|
|||||||
int id,
|
int id,
|
||||||
int nkeys,
|
int nkeys,
|
||||||
int *key,
|
int *key,
|
||||||
HeapTuple (*iScanfuncP) ())
|
ScanFunc iScanfuncP)
|
||||||
{
|
{
|
||||||
CatCache *cp;
|
CatCache *cp;
|
||||||
int i;
|
int i;
|
||||||
@ -797,11 +797,11 @@ InitSysCache(char *relname,
|
|||||||
* This code short-circuits the normal index lookup for cache loads
|
* This code short-circuits the normal index lookup for cache loads
|
||||||
* in those cases and replaces it with a heap scan.
|
* in those cases and replaces it with a heap scan.
|
||||||
*
|
*
|
||||||
* cache should already be initailized
|
* cache should already be initialized
|
||||||
* --------------------------------
|
* --------------------------------
|
||||||
*/
|
*/
|
||||||
static HeapTuple
|
static HeapTuple
|
||||||
SearchSelfReferences(struct catcache * cache)
|
SearchSelfReferences(CatCache * cache)
|
||||||
{
|
{
|
||||||
HeapTuple ntp;
|
HeapTuple ntp;
|
||||||
Relation rel;
|
Relation rel;
|
||||||
@ -896,7 +896,7 @@ SearchSelfReferences(struct catcache * cache)
|
|||||||
* --------------------------------
|
* --------------------------------
|
||||||
*/
|
*/
|
||||||
HeapTuple
|
HeapTuple
|
||||||
SearchSysCache(struct catcache * cache,
|
SearchSysCache(CatCache * cache,
|
||||||
Datum v1,
|
Datum v1,
|
||||||
Datum v2,
|
Datum v2,
|
||||||
Datum v3,
|
Datum v3,
|
||||||
@ -1035,34 +1035,22 @@ SearchSysCache(struct catcache * cache,
|
|||||||
if ((RelationGetForm(relation))->relhasindex
|
if ((RelationGetForm(relation))->relhasindex
|
||||||
&& !IsIgnoringSystemIndexes())
|
&& !IsIgnoringSystemIndexes())
|
||||||
{
|
{
|
||||||
|
HeapTuple indextp;
|
||||||
|
|
||||||
/* ----------
|
/* ----------
|
||||||
* Switch back to old memory context so memory not freed
|
* Switch back to old memory context so memory not freed
|
||||||
* in the scan function will go away at transaction end.
|
* in the scan function will go away at transaction end.
|
||||||
* wieck - 10/18/1996
|
* wieck - 10/18/1996
|
||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
HeapTuple indextp;
|
|
||||||
|
|
||||||
MemoryContextSwitchTo(oldcxt);
|
MemoryContextSwitchTo(oldcxt);
|
||||||
Assert(cache->cc_iscanfunc);
|
|
||||||
switch (cache->cc_nkeys)
|
/* We call the scanfunc with all four arguments to satisfy the
|
||||||
{
|
* declared prototype, even though the function will likely not
|
||||||
case 4:
|
* use all four.
|
||||||
indextp = cache->cc_iscanfunc(relation, v1, v2, v3, v4);
|
*/
|
||||||
break;
|
indextp = cache->cc_iscanfunc(relation, v1, v2, v3, v4);
|
||||||
case 3:
|
|
||||||
indextp = cache->cc_iscanfunc(relation, v1, v2, v3);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
indextp = cache->cc_iscanfunc(relation, v1, v2);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
indextp = cache->cc_iscanfunc(relation, v1);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
indextp = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* ----------
|
/* ----------
|
||||||
* Back to Cache context. If we got a tuple copy it
|
* Back to Cache context. If we got a tuple copy it
|
||||||
* into our context. wieck - 10/18/1996
|
* into our context. wieck - 10/18/1996
|
||||||
@ -1200,7 +1188,7 @@ RelationInvalidateCatalogCacheTuple(Relation relation,
|
|||||||
HeapTuple tuple,
|
HeapTuple tuple,
|
||||||
void (*function) (int, Index, ItemPointer))
|
void (*function) (int, Index, ItemPointer))
|
||||||
{
|
{
|
||||||
struct catcache *ccp;
|
CatCache *ccp;
|
||||||
MemoryContext oldcxt;
|
MemoryContext oldcxt;
|
||||||
Oid relationId;
|
Oid relationId;
|
||||||
|
|
||||||
@ -1251,6 +1239,4 @@ RelationInvalidateCatalogCacheTuple(Relation relation,
|
|||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
MemoryContextSwitchTo(oldcxt);
|
MemoryContextSwitchTo(oldcxt);
|
||||||
|
|
||||||
/* sendpm('I', "Invalidated tuple"); */
|
|
||||||
}
|
}
|
||||||
|
28
src/backend/utils/cache/relcache.c
vendored
28
src/backend/utils/cache/relcache.c
vendored
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.99 2000/06/02 15:57:30 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.100 2000/06/17 04:56:32 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -344,12 +344,13 @@ scan_pg_rel_ind(RelationBuildDescInfo buildinfo)
|
|||||||
switch (buildinfo.infotype)
|
switch (buildinfo.infotype)
|
||||||
{
|
{
|
||||||
case INFO_RELID:
|
case INFO_RELID:
|
||||||
return_tuple = ClassOidIndexScan(pg_class_desc, buildinfo.i.info_id);
|
return_tuple = ClassOidIndexScan(pg_class_desc,
|
||||||
|
ObjectIdGetDatum(buildinfo.i.info_id));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INFO_RELNAME:
|
case INFO_RELNAME:
|
||||||
return_tuple = ClassNameIndexScan(pg_class_desc,
|
return_tuple = ClassNameIndexScan(pg_class_desc,
|
||||||
buildinfo.i.info_name);
|
PointerGetDatum(buildinfo.i.info_name));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -382,10 +383,17 @@ AllocateRelationDesc(Relation relation, u_int natts,
|
|||||||
Form_pg_class relationForm;
|
Form_pg_class relationForm;
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* allocate space for the relation tuple form
|
* Copy the relation tuple form
|
||||||
|
*
|
||||||
|
* We only allocate space for the fixed fields, ie, CLASS_TUPLE_SIZE.
|
||||||
|
* relacl is NOT stored in the relcache --- there'd be little point
|
||||||
|
* in it, since we don't copy the tuple's nullvalues bitmap and hence
|
||||||
|
* wouldn't know if the value is valid ... bottom line is that relacl
|
||||||
|
* *cannot* be retrieved from the relcache. Get it from the syscache
|
||||||
|
* if you need it.
|
||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
relationForm = (Form_pg_class) palloc(sizeof(FormData_pg_class));
|
relationForm = (Form_pg_class) palloc(CLASS_TUPLE_SIZE);
|
||||||
|
|
||||||
memcpy((char *) relationForm, (char *) relp, CLASS_TUPLE_SIZE);
|
memcpy((char *) relationForm, (char *) relp, CLASS_TUPLE_SIZE);
|
||||||
|
|
||||||
@ -586,14 +594,16 @@ build_tupdesc_ind(RelationBuildDescInfo buildinfo,
|
|||||||
bool columnDropped = false;
|
bool columnDropped = false;
|
||||||
#endif /* _DROP_COLUMN_HACK__ */
|
#endif /* _DROP_COLUMN_HACK__ */
|
||||||
|
|
||||||
atttup = (HeapTuple) AttributeRelidNumIndexScan(attrel,
|
atttup = AttributeRelidNumIndexScan(attrel,
|
||||||
RelationGetRelid(relation), i);
|
ObjectIdGetDatum(RelationGetRelid(relation)),
|
||||||
|
Int32GetDatum(i));
|
||||||
|
|
||||||
if (!HeapTupleIsValid(atttup))
|
if (!HeapTupleIsValid(atttup))
|
||||||
{
|
{
|
||||||
#ifdef _DROP_COLUMN_HACK__
|
#ifdef _DROP_COLUMN_HACK__
|
||||||
atttup = (HeapTuple) AttributeRelidNumIndexScan(attrel,
|
atttup = AttributeRelidNumIndexScan(attrel,
|
||||||
RelationGetRelid(relation), DROPPED_COLUMN_INDEX(i));
|
ObjectIdGetDatum(RelationGetRelid(relation)),
|
||||||
|
Int32GetDatum(DROPPED_COLUMN_INDEX(i)));
|
||||||
if (!HeapTupleIsValid(atttup))
|
if (!HeapTupleIsValid(atttup))
|
||||||
#endif /* _DROP_COLUMN_HACK__ */
|
#endif /* _DROP_COLUMN_HACK__ */
|
||||||
elog(ERROR, "cannot find attribute %d of relation %s", i,
|
elog(ERROR, "cannot find attribute %d of relation %s", i,
|
||||||
|
248
src/backend/utils/cache/syscache.c
vendored
248
src/backend/utils/cache/syscache.c
vendored
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.53 2000/06/07 04:09:36 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/cache/syscache.c,v 1.54 2000/06/17 04:56:33 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* These routines allow the parser/planner/executor to perform
|
* These routines allow the parser/planner/executor to perform
|
||||||
@ -20,9 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
|
|
||||||
#include "utils/builtins.h"
|
|
||||||
#include "access/heapam.h"
|
#include "access/heapam.h"
|
||||||
|
#include "access/transam.h"
|
||||||
|
#include "utils/builtins.h"
|
||||||
#include "catalog/catname.h"
|
#include "catalog/catname.h"
|
||||||
|
#include "catalog/indexing.h"
|
||||||
#include "catalog/pg_aggregate.h"
|
#include "catalog/pg_aggregate.h"
|
||||||
#include "catalog/pg_amop.h"
|
#include "catalog/pg_amop.h"
|
||||||
#include "catalog/pg_group.h"
|
#include "catalog/pg_group.h"
|
||||||
@ -38,16 +40,10 @@
|
|||||||
#include "catalog/pg_statistic.h"
|
#include "catalog/pg_statistic.h"
|
||||||
#include "catalog/pg_type.h"
|
#include "catalog/pg_type.h"
|
||||||
#include "utils/catcache.h"
|
#include "utils/catcache.h"
|
||||||
|
#include "utils/syscache.h"
|
||||||
#include "utils/temprel.h"
|
#include "utils/temprel.h"
|
||||||
#include "miscadmin.h"
|
#include "miscadmin.h"
|
||||||
|
|
||||||
extern bool AMI_OVERRIDE; /* XXX style */
|
|
||||||
|
|
||||||
#include "utils/syscache.h"
|
|
||||||
#include "catalog/indexing.h"
|
|
||||||
|
|
||||||
typedef HeapTuple (*ScanFunc) ();
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -59,19 +55,18 @@ typedef HeapTuple (*ScanFunc) ();
|
|||||||
|
|
||||||
Add your entry to the cacheinfo[] array below. All cache lists are
|
Add your entry to the cacheinfo[] array below. All cache lists are
|
||||||
alphabetical, so add it in the proper place. Specify the relation
|
alphabetical, so add it in the proper place. Specify the relation
|
||||||
name, number of arguments, argument names, size of tuple, index lookup
|
name, number of arguments, argument attribute numbers, index name,
|
||||||
function, and index name.
|
and index lookup function.
|
||||||
|
|
||||||
In include/catalog/indexing.h, add a define for the number of indexes
|
In include/catalog/indexing.h, add a define for the number of indexes
|
||||||
in the relation, add a define for the index name, add an extern
|
on the relation, add define(s) for the index name(s), add an extern
|
||||||
array to hold the index names, define the index lookup function
|
array to hold the index names, define the index lookup function
|
||||||
prototype, and use DECLARE_UNIQUE_INDEX to define the index. Cache
|
prototype, and use DECLARE_UNIQUE_INDEX to define the index. Cache
|
||||||
lookups return only one row, so the index should be unique.
|
lookups return only one row, so the index should be unique.
|
||||||
|
|
||||||
In backend/catalog/indexing.c, initialize the relation array with
|
In backend/catalog/indexing.c, initialize the relation array with
|
||||||
the index names for the relation, fixed size of relation (or marking
|
the index names for the relation, and create the index lookup function.
|
||||||
first non-fixed length field), and create the index lookup function.
|
Pick one that has similar arguments and copy that one, but keep the
|
||||||
Pick one that has similar arguments and use that one, but keep the
|
|
||||||
function names in the same order as the cache list for clarity.
|
function names in the same order as the cache list for clarity.
|
||||||
|
|
||||||
Finally, any place your relation gets heap_insert() or
|
Finally, any place your relation gets heap_insert() or
|
||||||
@ -83,6 +78,19 @@ typedef HeapTuple (*ScanFunc) ();
|
|||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* ----------------
|
||||||
|
* struct cachedesc: information defining a single syscache
|
||||||
|
* ----------------
|
||||||
|
*/
|
||||||
|
struct cachedesc
|
||||||
|
{
|
||||||
|
char *name; /* name of the relation being cached */
|
||||||
|
int nkeys; /* # of keys needed for cache lookup */
|
||||||
|
int key[4]; /* attribute numbers of key attrs */
|
||||||
|
char *indname; /* name of index relation for this cache */
|
||||||
|
ScanFunc iScanFunc; /* function to handle index scans */
|
||||||
|
};
|
||||||
|
|
||||||
static struct cachedesc cacheinfo[] = {
|
static struct cachedesc cacheinfo[] = {
|
||||||
{AggregateRelationName, /* AGGNAME */
|
{AggregateRelationName, /* AGGNAME */
|
||||||
2,
|
2,
|
||||||
@ -92,9 +100,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_aggregate, agginitval1),
|
AggregateNameTypeIndex,
|
||||||
AggregateNameTypeIndex,
|
(ScanFunc) AggregateNameTypeIndexScan},
|
||||||
AggregateNameTypeIndexScan},
|
|
||||||
{AccessMethodRelationName, /* AMNAME */
|
{AccessMethodRelationName, /* AMNAME */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -103,9 +110,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
sizeof(FormData_pg_am),
|
AmNameIndex,
|
||||||
AmNameIndex,
|
(ScanFunc) AmNameIndexScan},
|
||||||
AmNameIndexScan},
|
|
||||||
{AccessMethodOperatorRelationName, /* AMOPOPID */
|
{AccessMethodOperatorRelationName, /* AMOPOPID */
|
||||||
3,
|
3,
|
||||||
{
|
{
|
||||||
@ -114,9 +120,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
Anum_pg_amop_amopid,
|
Anum_pg_amop_amopid,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
sizeof(FormData_pg_amop),
|
AccessMethodOpidIndex,
|
||||||
AccessMethodOpidIndex,
|
(ScanFunc) AccessMethodOpidIndexScan},
|
||||||
AccessMethodOpidIndexScan},
|
|
||||||
{AccessMethodOperatorRelationName, /* AMOPSTRATEGY */
|
{AccessMethodOperatorRelationName, /* AMOPSTRATEGY */
|
||||||
3,
|
3,
|
||||||
{
|
{
|
||||||
@ -125,8 +130,7 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
Anum_pg_amop_amopstrategy,
|
Anum_pg_amop_amopstrategy,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
sizeof(FormData_pg_amop),
|
AccessMethodStrategyIndex,
|
||||||
AccessMethodStrategyIndex,
|
|
||||||
(ScanFunc) AccessMethodStrategyIndexScan},
|
(ScanFunc) AccessMethodStrategyIndexScan},
|
||||||
{AttributeRelationName, /* ATTNAME */
|
{AttributeRelationName, /* ATTNAME */
|
||||||
2,
|
2,
|
||||||
@ -136,9 +140,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
ATTRIBUTE_TUPLE_SIZE,
|
AttributeRelidNameIndex,
|
||||||
AttributeRelidNameIndex,
|
(ScanFunc) AttributeRelidNameIndexScan},
|
||||||
AttributeRelidNameIndexScan},
|
|
||||||
{AttributeRelationName, /* ATTNUM */
|
{AttributeRelationName, /* ATTNUM */
|
||||||
2,
|
2,
|
||||||
{
|
{
|
||||||
@ -147,8 +150,7 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
ATTRIBUTE_TUPLE_SIZE,
|
AttributeRelidNumIndex,
|
||||||
AttributeRelidNumIndex,
|
|
||||||
(ScanFunc) AttributeRelidNumIndexScan},
|
(ScanFunc) AttributeRelidNumIndexScan},
|
||||||
{OperatorClassRelationName, /* CLADEFTYPE */
|
{OperatorClassRelationName, /* CLADEFTYPE */
|
||||||
1,
|
1,
|
||||||
@ -158,9 +160,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
sizeof(FormData_pg_opclass),
|
OpclassDeftypeIndex,
|
||||||
OpclassDeftypeIndex,
|
(ScanFunc) OpclassDeftypeIndexScan},
|
||||||
OpclassDeftypeIndexScan},
|
|
||||||
{OperatorClassRelationName, /* CLANAME */
|
{OperatorClassRelationName, /* CLANAME */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -169,9 +170,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
sizeof(FormData_pg_opclass),
|
OpclassNameIndex,
|
||||||
OpclassNameIndex,
|
(ScanFunc) OpclassNameIndexScan},
|
||||||
OpclassNameIndexScan},
|
|
||||||
{GroupRelationName, /* GRONAME */
|
{GroupRelationName, /* GRONAME */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -180,9 +180,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_group, grolist[0]),
|
GroupNameIndex,
|
||||||
GroupNameIndex,
|
(ScanFunc) GroupNameIndexScan},
|
||||||
GroupNameIndexScan},
|
|
||||||
{GroupRelationName, /* GROSYSID */
|
{GroupRelationName, /* GROSYSID */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -191,9 +190,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_group, grolist[0]),
|
GroupSysidIndex,
|
||||||
GroupSysidIndex,
|
(ScanFunc) GroupSysidIndexScan},
|
||||||
GroupSysidIndexScan},
|
|
||||||
{IndexRelationName, /* INDEXRELID */
|
{IndexRelationName, /* INDEXRELID */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -202,9 +200,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_index, indpred),
|
IndexRelidIndex,
|
||||||
IndexRelidIndex,
|
(ScanFunc) IndexRelidIndexScan},
|
||||||
IndexRelidIndexScan},
|
|
||||||
{InheritsRelationName, /* INHRELID */
|
{InheritsRelationName, /* INHRELID */
|
||||||
2,
|
2,
|
||||||
{
|
{
|
||||||
@ -213,9 +210,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
sizeof(FormData_pg_inherits),
|
InheritsRelidSeqnoIndex,
|
||||||
InheritsRelidSeqnoIndex,
|
(ScanFunc) InheritsRelidSeqnoIndexScan},
|
||||||
InheritsRelidSeqnoIndexScan},
|
|
||||||
{LanguageRelationName, /* LANGNAME */
|
{LanguageRelationName, /* LANGNAME */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -224,9 +220,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_language, lancompiler),
|
LanguageNameIndex,
|
||||||
LanguageNameIndex,
|
(ScanFunc) LanguageNameIndexScan},
|
||||||
LanguageNameIndexScan},
|
|
||||||
{LanguageRelationName, /* LANGOID */
|
{LanguageRelationName, /* LANGOID */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -235,9 +230,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_language, lancompiler),
|
LanguageOidIndex,
|
||||||
LanguageOidIndex,
|
(ScanFunc) LanguageOidIndexScan},
|
||||||
LanguageOidIndexScan},
|
|
||||||
{ListenerRelationName, /* LISTENREL */
|
{ListenerRelationName, /* LISTENREL */
|
||||||
2,
|
2,
|
||||||
{
|
{
|
||||||
@ -246,9 +240,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
sizeof(FormData_pg_listener),
|
ListenerPidRelnameIndex,
|
||||||
ListenerPidRelnameIndex,
|
(ScanFunc) ListenerPidRelnameIndexScan},
|
||||||
ListenerPidRelnameIndexScan},
|
|
||||||
{OperatorRelationName, /* OPERNAME */
|
{OperatorRelationName, /* OPERNAME */
|
||||||
4,
|
4,
|
||||||
{
|
{
|
||||||
@ -257,8 +250,7 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
Anum_pg_operator_oprright,
|
Anum_pg_operator_oprright,
|
||||||
Anum_pg_operator_oprkind
|
Anum_pg_operator_oprkind
|
||||||
},
|
},
|
||||||
sizeof(FormData_pg_operator),
|
OperatorNameIndex,
|
||||||
OperatorNameIndex,
|
|
||||||
(ScanFunc) OperatorNameIndexScan},
|
(ScanFunc) OperatorNameIndexScan},
|
||||||
{OperatorRelationName, /* OPEROID */
|
{OperatorRelationName, /* OPEROID */
|
||||||
1,
|
1,
|
||||||
@ -268,9 +260,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
sizeof(FormData_pg_operator),
|
OperatorOidIndex,
|
||||||
OperatorOidIndex,
|
(ScanFunc) OperatorOidIndexScan},
|
||||||
OperatorOidIndexScan},
|
|
||||||
{ProcedureRelationName, /* PROCNAME */
|
{ProcedureRelationName, /* PROCNAME */
|
||||||
3,
|
3,
|
||||||
{
|
{
|
||||||
@ -279,8 +270,7 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
Anum_pg_proc_proargtypes,
|
Anum_pg_proc_proargtypes,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_proc, prosrc),
|
ProcedureNameIndex,
|
||||||
ProcedureNameIndex,
|
|
||||||
(ScanFunc) ProcedureNameIndexScan},
|
(ScanFunc) ProcedureNameIndexScan},
|
||||||
{ProcedureRelationName, /* PROCOID */
|
{ProcedureRelationName, /* PROCOID */
|
||||||
1,
|
1,
|
||||||
@ -290,9 +280,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_proc, prosrc),
|
ProcedureOidIndex,
|
||||||
ProcedureOidIndex,
|
(ScanFunc) ProcedureOidIndexScan},
|
||||||
ProcedureOidIndexScan},
|
|
||||||
{RelationRelationName, /* RELNAME */
|
{RelationRelationName, /* RELNAME */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -301,9 +290,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
CLASS_TUPLE_SIZE,
|
ClassNameIndex,
|
||||||
ClassNameIndex,
|
(ScanFunc) ClassNameIndexScan},
|
||||||
ClassNameIndexScan},
|
|
||||||
{RelationRelationName, /* RELOID */
|
{RelationRelationName, /* RELOID */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -312,9 +300,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
CLASS_TUPLE_SIZE,
|
ClassOidIndex,
|
||||||
ClassOidIndex,
|
(ScanFunc) ClassOidIndexScan},
|
||||||
ClassOidIndexScan},
|
|
||||||
{RewriteRelationName, /* REWRITENAME */
|
{RewriteRelationName, /* REWRITENAME */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -323,9 +310,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_rewrite, ev_qual),
|
RewriteRulenameIndex,
|
||||||
RewriteRulenameIndex,
|
(ScanFunc) RewriteRulenameIndexScan},
|
||||||
RewriteRulenameIndexScan},
|
|
||||||
{RewriteRelationName, /* RULEOID */
|
{RewriteRelationName, /* RULEOID */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -334,9 +320,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_rewrite, ev_qual),
|
RewriteOidIndex,
|
||||||
RewriteOidIndex,
|
(ScanFunc) RewriteOidIndexScan},
|
||||||
RewriteOidIndexScan},
|
|
||||||
{ShadowRelationName, /* SHADOWNAME */
|
{ShadowRelationName, /* SHADOWNAME */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -345,9 +330,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
sizeof(FormData_pg_shadow),
|
ShadowNameIndex,
|
||||||
ShadowNameIndex,
|
(ScanFunc) ShadowNameIndexScan},
|
||||||
ShadowNameIndexScan},
|
|
||||||
{ShadowRelationName, /* SHADOWSYSID */
|
{ShadowRelationName, /* SHADOWSYSID */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -356,9 +340,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
sizeof(FormData_pg_shadow),
|
ShadowSysidIndex,
|
||||||
ShadowSysidIndex,
|
(ScanFunc) ShadowSysidIndexScan},
|
||||||
ShadowSysidIndexScan},
|
|
||||||
{StatisticRelationName, /* STATRELID */
|
{StatisticRelationName, /* STATRELID */
|
||||||
2,
|
2,
|
||||||
{
|
{
|
||||||
@ -367,8 +350,7 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_statistic, stacommonval),
|
StatisticRelidAttnumIndex,
|
||||||
StatisticRelidAttnumIndex,
|
|
||||||
(ScanFunc) StatisticRelidAttnumIndexScan},
|
(ScanFunc) StatisticRelidAttnumIndexScan},
|
||||||
{TypeRelationName, /* TYPENAME */
|
{TypeRelationName, /* TYPENAME */
|
||||||
1,
|
1,
|
||||||
@ -378,9 +360,8 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_type, typalign) +sizeof(char),
|
TypeNameIndex,
|
||||||
TypeNameIndex,
|
(ScanFunc) TypeNameIndexScan},
|
||||||
TypeNameIndexScan},
|
|
||||||
{TypeRelationName, /* TYPEOID */
|
{TypeRelationName, /* TYPEOID */
|
||||||
1,
|
1,
|
||||||
{
|
{
|
||||||
@ -389,16 +370,16 @@ static struct cachedesc cacheinfo[] = {
|
|||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
},
|
},
|
||||||
offsetof(FormData_pg_type, typalign) +sizeof(char),
|
TypeOidIndex,
|
||||||
TypeOidIndex,
|
(ScanFunc) TypeOidIndexScan}
|
||||||
TypeOidIndexScan}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct catcache *SysCache[
|
static CatCache *SysCache[lengthof(cacheinfo)];
|
||||||
lengthof(cacheinfo)];
|
|
||||||
static int32 SysCacheSize = lengthof(cacheinfo);
|
static int32 SysCacheSize = lengthof(cacheinfo);
|
||||||
static bool CacheInitialized = false;
|
static bool CacheInitialized = false;
|
||||||
extern bool
|
|
||||||
|
|
||||||
|
bool
|
||||||
IsCacheInitialized(void)
|
IsCacheInitialized(void)
|
||||||
{
|
{
|
||||||
return CacheInitialized;
|
return CacheInitialized;
|
||||||
@ -413,14 +394,12 @@ IsCacheInitialized(void)
|
|||||||
void
|
void
|
||||||
zerocaches()
|
zerocaches()
|
||||||
{
|
{
|
||||||
MemSet((char *) SysCache, 0, SysCacheSize * sizeof(struct catcache *));
|
MemSet((char *) SysCache, 0, SysCacheSize * sizeof(CatCache *));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note:
|
* InitCatalogCache - initialize the caches
|
||||||
* This function was written because the initialized catalog caches
|
|
||||||
* are used to determine which caches may contain tuples which need
|
|
||||||
* to be invalidated in other backends.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
InitCatalogCache()
|
InitCatalogCache()
|
||||||
@ -431,8 +410,7 @@ InitCatalogCache()
|
|||||||
{
|
{
|
||||||
for (cacheId = 0; cacheId < SysCacheSize; cacheId += 1)
|
for (cacheId = 0; cacheId < SysCacheSize; cacheId += 1)
|
||||||
{
|
{
|
||||||
|
Assert(!PointerIsValid(SysCache[cacheId]));
|
||||||
Assert(!PointerIsValid((Pointer) SysCache[cacheId]));
|
|
||||||
|
|
||||||
SysCache[cacheId] = InitSysCache(cacheinfo[cacheId].name,
|
SysCache[cacheId] = InitSysCache(cacheinfo[cacheId].name,
|
||||||
cacheinfo[cacheId].indname,
|
cacheinfo[cacheId].indname,
|
||||||
@ -440,10 +418,10 @@ InitCatalogCache()
|
|||||||
cacheinfo[cacheId].nkeys,
|
cacheinfo[cacheId].nkeys,
|
||||||
cacheinfo[cacheId].key,
|
cacheinfo[cacheId].key,
|
||||||
cacheinfo[cacheId].iScanFunc);
|
cacheinfo[cacheId].iScanFunc);
|
||||||
if (!PointerIsValid((char *) SysCache[cacheId]))
|
if (!PointerIsValid(SysCache[cacheId]))
|
||||||
{
|
{
|
||||||
elog(ERROR,
|
elog(ERROR,
|
||||||
"InitCatalogCache: Can't init cache %s(%d)",
|
"InitCatalogCache: Can't init cache %s (%d)",
|
||||||
cacheinfo[cacheId].name,
|
cacheinfo[cacheId].name,
|
||||||
cacheId);
|
cacheId);
|
||||||
}
|
}
|
||||||
@ -453,30 +431,6 @@ InitCatalogCache()
|
|||||||
CacheInitialized = true;
|
CacheInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* SearchSysCacheTupleCopy
|
|
||||||
*
|
|
||||||
* This is like SearchSysCacheTuple, except it returns a palloc'd copy of
|
|
||||||
* the tuple. The caller should heap_freetuple() the returned copy when
|
|
||||||
* done with it. This routine should be used when the caller intends to
|
|
||||||
* continue to access the tuple for more than a very short period of time.
|
|
||||||
*/
|
|
||||||
HeapTuple
|
|
||||||
SearchSysCacheTupleCopy(int cacheId, /* cache selection code */
|
|
||||||
Datum key1,
|
|
||||||
Datum key2,
|
|
||||||
Datum key3,
|
|
||||||
Datum key4)
|
|
||||||
{
|
|
||||||
HeapTuple cachetup;
|
|
||||||
|
|
||||||
cachetup = SearchSysCacheTuple(cacheId, key1, key2, key3, key4);
|
|
||||||
if (PointerIsValid(cachetup))
|
|
||||||
return heap_copytuple(cachetup);
|
|
||||||
else
|
|
||||||
return cachetup; /* NULL */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SearchSysCacheTuple
|
* SearchSysCacheTuple
|
||||||
@ -492,6 +446,9 @@ SearchSysCacheTupleCopy(int cacheId, /* cache selection code */
|
|||||||
* CAUTION: The returned tuple may be flushed from the cache during
|
* CAUTION: The returned tuple may be flushed from the cache during
|
||||||
* subsequent cache lookup operations, or by shared cache invalidation.
|
* subsequent cache lookup operations, or by shared cache invalidation.
|
||||||
* Callers should not expect the pointer to remain valid for long.
|
* Callers should not expect the pointer to remain valid for long.
|
||||||
|
*
|
||||||
|
* XXX we ought to have some kind of referencecount mechanism for
|
||||||
|
* cache entries, to ensure entries aren't deleted while in use.
|
||||||
*/
|
*/
|
||||||
HeapTuple
|
HeapTuple
|
||||||
SearchSysCacheTuple(int cacheId,/* cache selection code */
|
SearchSysCacheTuple(int cacheId,/* cache selection code */
|
||||||
@ -550,6 +507,31 @@ SearchSysCacheTuple(int cacheId,/* cache selection code */
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SearchSysCacheTupleCopy
|
||||||
|
*
|
||||||
|
* This is like SearchSysCacheTuple, except it returns a palloc'd copy of
|
||||||
|
* the tuple. The caller should heap_freetuple() the returned copy when
|
||||||
|
* done with it. This routine should be used when the caller intends to
|
||||||
|
* continue to access the tuple for more than a very short period of time.
|
||||||
|
*/
|
||||||
|
HeapTuple
|
||||||
|
SearchSysCacheTupleCopy(int cacheId, /* cache selection code */
|
||||||
|
Datum key1,
|
||||||
|
Datum key2,
|
||||||
|
Datum key3,
|
||||||
|
Datum key4)
|
||||||
|
{
|
||||||
|
HeapTuple cachetup;
|
||||||
|
|
||||||
|
cachetup = SearchSysCacheTuple(cacheId, key1, key2, key3, key4);
|
||||||
|
if (PointerIsValid(cachetup))
|
||||||
|
return heap_copytuple(cachetup);
|
||||||
|
else
|
||||||
|
return cachetup; /* NULL */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SysCacheGetAttr
|
* SysCacheGetAttr
|
||||||
*
|
*
|
||||||
@ -569,13 +551,13 @@ SearchSysCacheTuple(int cacheId,/* cache selection code */
|
|||||||
Datum
|
Datum
|
||||||
SysCacheGetAttr(int cacheId, HeapTuple tup,
|
SysCacheGetAttr(int cacheId, HeapTuple tup,
|
||||||
AttrNumber attributeNumber,
|
AttrNumber attributeNumber,
|
||||||
bool *isnull)
|
bool *isNull)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We just need to get the TupleDesc out of the cache entry, and then
|
* We just need to get the TupleDesc out of the cache entry, and then
|
||||||
* we can apply heap_getattr(). We expect that the cache control data
|
* we can apply heap_getattr(). We expect that the cache control data
|
||||||
* is currently valid --- if the caller just fetched the tuple, then
|
* is currently valid --- if the caller recently fetched the tuple, then
|
||||||
* it should be.
|
* it should be.
|
||||||
*/
|
*/
|
||||||
if (cacheId < 0 || cacheId >= SysCacheSize)
|
if (cacheId < 0 || cacheId >= SysCacheSize)
|
||||||
@ -587,5 +569,5 @@ SysCacheGetAttr(int cacheId, HeapTuple tup,
|
|||||||
|
|
||||||
return heap_getattr(tup, attributeNumber,
|
return heap_getattr(tup, attributeNumber,
|
||||||
SysCache[cacheId]->cc_tupdesc,
|
SysCache[cacheId]->cc_tupdesc,
|
||||||
isnull);
|
isNull);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: indexing.h,v 1.39 2000/06/07 04:09:44 momjian Exp $
|
* $Id: indexing.h,v 1.40 2000/06/17 04:56:30 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -18,7 +18,7 @@
|
|||||||
#include "access/htup.h"
|
#include "access/htup.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some definitions for indices on pg_attribute
|
* Number of indices that exist for each system catalog
|
||||||
*/
|
*/
|
||||||
#define Num_pg_aggregate_indices 1
|
#define Num_pg_aggregate_indices 1
|
||||||
#define Num_pg_am_indices 1
|
#define Num_pg_am_indices 1
|
||||||
@ -42,7 +42,6 @@
|
|||||||
#define Num_pg_trigger_indices 3
|
#define Num_pg_trigger_indices 3
|
||||||
#define Num_pg_type_indices 2
|
#define Num_pg_type_indices 2
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Names of indices on system catalogs
|
* Names of indices on system catalogs
|
||||||
*/
|
*/
|
||||||
@ -109,56 +108,58 @@ extern char *IndexedCatalogNames[];
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* indexing.c prototypes
|
* indexing.c prototypes
|
||||||
*
|
|
||||||
* Functions for each index to perform the necessary scan on a cache miss.
|
|
||||||
*/
|
*/
|
||||||
extern void CatalogOpenIndices(int nIndices, char **names, Relation *idescs);
|
extern void CatalogOpenIndices(int nIndices, char **names, Relation *idescs);
|
||||||
extern void CatalogCloseIndices(int nIndices, Relation *idescs);
|
extern void CatalogCloseIndices(int nIndices, Relation *idescs);
|
||||||
extern void CatalogIndexInsert(Relation *idescs,
|
extern void CatalogIndexInsert(Relation *idescs, int nIndices,
|
||||||
int nIndices,
|
Relation heapRelation, HeapTuple heapTuple);
|
||||||
Relation heapRelation,
|
|
||||||
HeapTuple heapTuple);
|
|
||||||
extern bool CatalogHasIndex(char *catName, Oid catId);
|
extern bool CatalogHasIndex(char *catName, Oid catId);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions for each index to perform the necessary scan on a cache miss.
|
||||||
|
* All index-value arguments should be passed as Datum for portability!
|
||||||
|
*/
|
||||||
extern HeapTuple AccessMethodOpidIndexScan(Relation heapRelation,
|
extern HeapTuple AccessMethodOpidIndexScan(Relation heapRelation,
|
||||||
Oid claid, Oid opopr, Oid opid);
|
Datum claid, Datum opopr, Datum opid);
|
||||||
extern HeapTuple AccessMethodStrategyIndexScan(Relation heapRelation,
|
extern HeapTuple AccessMethodStrategyIndexScan(Relation heapRelation,
|
||||||
Oid opid, Oid claid, int2 opstrategy);
|
Datum opid, Datum claid, Datum opstrategy);
|
||||||
extern HeapTuple AggregateNameTypeIndexScan(Relation heapRelation,
|
extern HeapTuple AggregateNameTypeIndexScan(Relation heapRelation,
|
||||||
char *aggName, Oid aggType);
|
Datum aggName, Datum aggType);
|
||||||
extern HeapTuple AmNameIndexScan(Relation heapRelation, char *amName);
|
extern HeapTuple AmNameIndexScan(Relation heapRelation, Datum amName);
|
||||||
extern HeapTuple AttributeRelidNameIndexScan(Relation heapRelation,
|
extern HeapTuple AttributeRelidNameIndexScan(Relation heapRelation,
|
||||||
Oid relid, char *attname);
|
Datum relid, Datum attname);
|
||||||
extern HeapTuple AttributeRelidNumIndexScan(Relation heapRelation,
|
extern HeapTuple AttributeRelidNumIndexScan(Relation heapRelation,
|
||||||
Oid relid, AttrNumber attnum);
|
Datum relid, Datum attnum);
|
||||||
extern HeapTuple ClassNameIndexScan(Relation heapRelation, char *relName);
|
extern HeapTuple ClassNameIndexScan(Relation heapRelation, Datum relName);
|
||||||
extern HeapTuple ClassNameIndexScan(Relation heapRelation, char *relName);
|
extern HeapTuple ClassNameIndexScan(Relation heapRelation, Datum relName);
|
||||||
extern HeapTuple ClassOidIndexScan(Relation heapRelation, Oid relId);
|
extern HeapTuple ClassOidIndexScan(Relation heapRelation, Datum relId);
|
||||||
extern HeapTuple GroupNameIndexScan(Relation heapRelation, char *groName);
|
extern HeapTuple GroupNameIndexScan(Relation heapRelation, Datum groName);
|
||||||
extern HeapTuple GroupSysidIndexScan(Relation heapRelation, int4 sysId);
|
extern HeapTuple GroupSysidIndexScan(Relation heapRelation, Datum sysId);
|
||||||
extern HeapTuple IndexRelidIndexScan(Relation heapRelation, Oid relid);
|
extern HeapTuple IndexRelidIndexScan(Relation heapRelation, Datum relid);
|
||||||
extern HeapTuple InheritsRelidSeqnoIndexScan(Relation heapRelation, Oid relid,
|
extern HeapTuple InheritsRelidSeqnoIndexScan(Relation heapRelation,
|
||||||
int4 seqno);
|
Datum relid, Datum seqno);
|
||||||
extern HeapTuple LanguageNameIndexScan(Relation heapRelation, char *lanName);
|
extern HeapTuple LanguageNameIndexScan(Relation heapRelation, Datum lanName);
|
||||||
extern HeapTuple LanguageOidIndexScan(Relation heapRelation, Oid lanId);
|
extern HeapTuple LanguageOidIndexScan(Relation heapRelation, Datum lanId);
|
||||||
extern HeapTuple ListenerPidRelnameIndexScan(Relation heapRelation, int4 pid, char *relName);
|
extern HeapTuple ListenerPidRelnameIndexScan(Relation heapRelation,
|
||||||
extern HeapTuple OpclassDeftypeIndexScan(Relation heapRelation, Oid defType);
|
Datum pid, Datum relName);
|
||||||
extern HeapTuple OpclassNameIndexScan(Relation heapRelation, char *opcName);
|
extern HeapTuple OpclassDeftypeIndexScan(Relation heapRelation, Datum defType);
|
||||||
|
extern HeapTuple OpclassNameIndexScan(Relation heapRelation, Datum opcName);
|
||||||
extern HeapTuple OperatorNameIndexScan(Relation heapRelation,
|
extern HeapTuple OperatorNameIndexScan(Relation heapRelation,
|
||||||
char *oprName, Oid oprLeft, Oid oprRight, char oprKind);
|
Datum oprName, Datum oprLeft,
|
||||||
extern HeapTuple OperatorOidIndexScan(Relation heapRelation, Oid oprId);
|
Datum oprRight, Datum oprKind);
|
||||||
|
extern HeapTuple OperatorOidIndexScan(Relation heapRelation, Datum oprId);
|
||||||
extern HeapTuple ProcedureNameIndexScan(Relation heapRelation,
|
extern HeapTuple ProcedureNameIndexScan(Relation heapRelation,
|
||||||
char *procName, int2 nargs, Oid *argTypes);
|
Datum procName, Datum nargs, Datum argTypes);
|
||||||
extern HeapTuple ProcedureOidIndexScan(Relation heapRelation, Oid procId);
|
extern HeapTuple ProcedureOidIndexScan(Relation heapRelation, Datum procId);
|
||||||
extern HeapTuple RewriteOidIndexScan(Relation heapRelation, Oid rewriteId);
|
extern HeapTuple RewriteOidIndexScan(Relation heapRelation, Datum rewriteId);
|
||||||
extern HeapTuple RewriteRulenameIndexScan(Relation heapRelation,
|
extern HeapTuple RewriteRulenameIndexScan(Relation heapRelation,
|
||||||
char *ruleName);
|
Datum ruleName);
|
||||||
extern HeapTuple ShadowNameIndexScan(Relation heapRelation, char *useName);
|
extern HeapTuple ShadowNameIndexScan(Relation heapRelation, Datum useName);
|
||||||
extern HeapTuple ShadowSysidIndexScan(Relation heapRelation, int4 sysId);
|
extern HeapTuple ShadowSysidIndexScan(Relation heapRelation, Datum sysId);
|
||||||
extern HeapTuple StatisticRelidAttnumIndexScan(Relation heapRelation,
|
extern HeapTuple StatisticRelidAttnumIndexScan(Relation heapRelation,
|
||||||
Oid relId, AttrNumber attNum);
|
Datum relId, Datum attNum);
|
||||||
extern HeapTuple TypeNameIndexScan(Relation heapRelation, char *typeName);
|
extern HeapTuple TypeNameIndexScan(Relation heapRelation, Datum typeName);
|
||||||
extern HeapTuple TypeOidIndexScan(Relation heapRelation, Oid typeId);
|
extern HeapTuple TypeOidIndexScan(Relation heapRelation, Datum typeId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,21 +8,16 @@
|
|||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: pg_class.h,v 1.37 2000/06/12 03:40:53 momjian Exp $
|
* $Id: pg_class.h,v 1.38 2000/06/17 04:56:31 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* ``pg_relation'' is being replaced by ``pg_class''. currently
|
|
||||||
* we are only changing the name in the catalogs but someday the
|
|
||||||
* code will be changed too. -cim 2/26/90
|
|
||||||
* [it finally happens. -ay 11/5/94]
|
|
||||||
*
|
|
||||||
* the genbki.sh script reads this file and generates .bki
|
* the genbki.sh script reads this file and generates .bki
|
||||||
* information from the DATA() statements.
|
* information from the DATA() statements.
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#ifndef PG_RELATION_H
|
#ifndef PG_CLASS_H
|
||||||
#define PG_RELATION_H
|
#define PG_CLASS_H
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* postgres.h contains the system type definintions and the
|
* postgres.h contains the system type definintions and the
|
||||||
@ -37,18 +32,16 @@
|
|||||||
*
|
*
|
||||||
* Note: the #if 0, #endif around the BKI_BEGIN.. END block
|
* Note: the #if 0, #endif around the BKI_BEGIN.. END block
|
||||||
* below keeps cpp from seeing what is meant for the
|
* below keeps cpp from seeing what is meant for the
|
||||||
* genbki script: pg_relation is now called pg_class, but
|
* genbki script
|
||||||
* only in the catalogs -cim 2/26/90
|
|
||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* This structure is actually variable-length (the last attribute is
|
* This structure is actually variable-length (the last attribute is
|
||||||
* a POSTGRES array). Hence, sizeof(FormData_pg_class) does not
|
* a POSTGRES array). Hence, sizeof(FormData_pg_class) does not
|
||||||
* describe the fixed-length or actual size of the structure.
|
* necessarily match the actual length of the structure. Furthermore
|
||||||
* FormData_pg_class.relacl may not be correctly aligned, either,
|
* relacl may be a NULL field. Hence, you MUST use heap_getattr()
|
||||||
* if aclitem and struct varlena don't align together. Hence,
|
* to get the relacl field ... and don't forget to check isNull.
|
||||||
* you MUST use heap_getattr() to get the relacl field.
|
|
||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
CATALOG(pg_class) BOOTSTRAP
|
CATALOG(pg_class) BOOTSTRAP
|
||||||
@ -64,24 +57,26 @@ CATALOG(pg_class) BOOTSTRAP
|
|||||||
bool relisshared;
|
bool relisshared;
|
||||||
char relkind;
|
char relkind;
|
||||||
int2 relnatts;
|
int2 relnatts;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* relnatts is the number of user attributes this class has. There
|
* relnatts is the number of user attributes this class has. There
|
||||||
* must be exactly this many instances in Class pg_attribute for this
|
* must be exactly this many instances in Class pg_attribute for this
|
||||||
* class which have attnum > 0 (= user attribute).
|
* class that have attnum > 0 (= user attribute).
|
||||||
*/
|
*/
|
||||||
int2 relchecks; /* # of CHECK constraints, not stored in
|
int2 relchecks; /* # of CHECK constraints for class */
|
||||||
* db? */
|
|
||||||
int2 reltriggers; /* # of TRIGGERs */
|
int2 reltriggers; /* # of TRIGGERs */
|
||||||
int2 relukeys; /* # of Unique keys */
|
int2 relukeys; /* # of Unique keys */
|
||||||
int2 relfkeys; /* # of FOREIGN KEYs */
|
int2 relfkeys; /* # of FOREIGN KEYs */
|
||||||
int2 relrefs; /* # of references to this relation */
|
int2 relrefs; /* # of references to this rel (not used!) */
|
||||||
bool relhaspkey; /* has PRIMARY KEY */
|
bool relhaspkey; /* has PRIMARY KEY */
|
||||||
bool relhasrules;
|
bool relhasrules; /* has associated rules */
|
||||||
bool relhassubclass;
|
bool relhassubclass; /* has derived classes */
|
||||||
aclitem relacl[1]; /* this is here for the catalog */
|
/*
|
||||||
|
* relacl may or may not be present, see note above!
|
||||||
|
*/
|
||||||
|
aclitem relacl[1]; /* we declare this just for the catalog */
|
||||||
} FormData_pg_class;
|
} FormData_pg_class;
|
||||||
|
|
||||||
|
/* Size of fixed part of pg_class tuples, not counting relacl or padding */
|
||||||
#define CLASS_TUPLE_SIZE \
|
#define CLASS_TUPLE_SIZE \
|
||||||
(offsetof(FormData_pg_class,relhassubclass) + sizeof(bool))
|
(offsetof(FormData_pg_class,relhassubclass) + sizeof(bool))
|
||||||
|
|
||||||
@ -123,7 +118,7 @@ typedef FormData_pg_class *Form_pg_class;
|
|||||||
#define Anum_pg_class_relrefs 16
|
#define Anum_pg_class_relrefs 16
|
||||||
#define Anum_pg_class_relhaspkey 17
|
#define Anum_pg_class_relhaspkey 17
|
||||||
#define Anum_pg_class_relhasrules 18
|
#define Anum_pg_class_relhasrules 18
|
||||||
#define Anum_pg_class_relhassubclass 19
|
#define Anum_pg_class_relhassubclass 19
|
||||||
#define Anum_pg_class_relacl 20
|
#define Anum_pg_class_relacl 20
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
@ -176,10 +171,10 @@ DESCR("");
|
|||||||
|
|
||||||
#define RELKIND_INDEX 'i' /* secondary index */
|
#define RELKIND_INDEX 'i' /* secondary index */
|
||||||
#define RELKIND_LOBJECT 'l' /* large objects */
|
#define RELKIND_LOBJECT 'l' /* large objects */
|
||||||
#define RELKIND_RELATION 'r' /* cataloged heap */
|
#define RELKIND_RELATION 'r' /* ordinary cataloged heap */
|
||||||
#define RELKIND_SPECIAL 's' /* special (non-heap) */
|
#define RELKIND_SPECIAL 's' /* special (non-heap) */
|
||||||
#define RELKIND_SEQUENCE 'S' /* SEQUENCE relation */
|
#define RELKIND_SEQUENCE 'S' /* SEQUENCE relation */
|
||||||
#define RELKIND_UNCATALOGED 'u' /* temporary heap */
|
#define RELKIND_UNCATALOGED 'u' /* temporary heap */
|
||||||
#define RELKIND_LONGVALUE 'v' /* moved off huge values */
|
#define RELKIND_LONGVALUE 'v' /* moved off huge values */
|
||||||
|
|
||||||
#endif /* PG_RELATION_H */
|
#endif /* PG_CLASS_H */
|
||||||
|
@ -7,18 +7,29 @@
|
|||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: catcache.h,v 1.23 2000/06/15 03:33:10 momjian Exp $
|
* $Id: catcache.h,v 1.24 2000/06/17 04:56:29 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#ifndef CATCACHE_H
|
#ifndef CATCACHE_H
|
||||||
#define CATCACHE_H
|
#define CATCACHE_H
|
||||||
|
|
||||||
/* #define CACHEDEBUG turns DEBUG elogs on */
|
/* #define CACHEDEBUG */ /* turns DEBUG elogs on */
|
||||||
|
|
||||||
#include "access/htup.h"
|
#include "access/htup.h"
|
||||||
#include "lib/dllist.h"
|
#include "lib/dllist.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions that implement index scans for caches must match this signature
|
||||||
|
* (except we allow unused key arguments to be omitted --- is that really
|
||||||
|
* portable?)
|
||||||
|
*/
|
||||||
|
typedef HeapTuple (*ScanFunc) (Relation heapRelation,
|
||||||
|
Datum key1,
|
||||||
|
Datum key2,
|
||||||
|
Datum key3,
|
||||||
|
Datum key4);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* struct catctup: tuples in the cache.
|
* struct catctup: tuples in the cache.
|
||||||
* struct catcache: information for managing a cache.
|
* struct catcache: information for managing a cache.
|
||||||
@ -26,8 +37,7 @@
|
|||||||
|
|
||||||
typedef struct catctup
|
typedef struct catctup
|
||||||
{
|
{
|
||||||
HeapTuple ct_tup; /* A pointer to a tuple */
|
HeapTuple ct_tup; /* A pointer to a tuple */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Each tuple in the cache has two catctup items, one in the LRU list
|
* Each tuple in the cache has two catctup items, one in the LRU list
|
||||||
* and one in the hashbucket list for its hash value. ct_node in each
|
* and one in the hashbucket list for its hash value. ct_node in each
|
||||||
@ -38,7 +48,7 @@ typedef struct catctup
|
|||||||
|
|
||||||
/* voodoo constants */
|
/* voodoo constants */
|
||||||
#define NCCBUCK 500 /* CatCache buckets */
|
#define NCCBUCK 500 /* CatCache buckets */
|
||||||
#define MAXTUP 300 /* Maximum # of tuples cached per cache */
|
#define MAXTUP 300 /* Maximum # of tuples stored per cache */
|
||||||
|
|
||||||
|
|
||||||
typedef struct catcache
|
typedef struct catcache
|
||||||
@ -47,7 +57,7 @@ typedef struct catcache
|
|||||||
Oid indexId;
|
Oid indexId;
|
||||||
char *cc_relname; /* relation name for defered open */
|
char *cc_relname; /* relation name for defered open */
|
||||||
char *cc_indname; /* index name for defered open */
|
char *cc_indname; /* index name for defered open */
|
||||||
HeapTuple (*cc_iscanfunc) (); /* index scanfunction */
|
ScanFunc cc_iscanfunc; /* index scan function */
|
||||||
TupleDesc cc_tupdesc; /* tuple descriptor from reldesc */
|
TupleDesc cc_tupdesc; /* tuple descriptor from reldesc */
|
||||||
int id; /* XXX could be improved -hirohama */
|
int id; /* XXX could be improved -hirohama */
|
||||||
bool busy; /* for detecting recursive lookups */
|
bool busy; /* for detecting recursive lookups */
|
||||||
@ -71,11 +81,14 @@ extern void CatalogCacheIdInvalidate(int cacheId, Index hashIndex,
|
|||||||
ItemPointer pointer);
|
ItemPointer pointer);
|
||||||
extern void ResetSystemCache(void);
|
extern void ResetSystemCache(void);
|
||||||
extern void SystemCacheRelationFlushed(Oid relId);
|
extern void SystemCacheRelationFlushed(Oid relId);
|
||||||
extern CatCache *InitSysCache(char *relname, char *indname, int id, int nkeys,
|
extern CatCache *InitSysCache(char *relname, char *indname, int id,
|
||||||
int *key, HeapTuple (*iScanfuncP) ());
|
int nkeys, int *key,
|
||||||
extern HeapTuple SearchSysCache(struct catcache * cache, Datum v1, Datum v2,
|
ScanFunc iScanfuncP);
|
||||||
Datum v3, Datum v4);
|
extern HeapTuple SearchSysCache(CatCache * cache,
|
||||||
|
Datum v1, Datum v2,
|
||||||
|
Datum v3, Datum v4);
|
||||||
extern void RelationInvalidateCatalogCacheTuple(Relation relation,
|
extern void RelationInvalidateCatalogCacheTuple(Relation relation,
|
||||||
HeapTuple tuple, void (*function) ());
|
HeapTuple tuple,
|
||||||
|
void (*function) (int, Index, ItemPointer));
|
||||||
|
|
||||||
#endif /* CATCACHE_H */
|
#endif /* CATCACHE_H */
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: syscache.h,v 1.25 2000/04/12 17:16:55 momjian Exp $
|
* $Id: syscache.h,v 1.26 2000/06/17 04:56:29 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -18,17 +18,14 @@
|
|||||||
|
|
||||||
#include "access/htup.h"
|
#include "access/htup.h"
|
||||||
|
|
||||||
/* #define CACHEDEBUG *//* turns DEBUG elogs on */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Declarations for util/syscache.c.
|
* Declarations for util/syscache.c.
|
||||||
*
|
*
|
||||||
* SysCache identifiers.
|
* SysCache identifiers.
|
||||||
*
|
*
|
||||||
* The order of these must match the order
|
* The order of these must match the order
|
||||||
* they are entered into the structure cacheinfo[] in syscache.c
|
* they are entered into the structure cacheinfo[] in syscache.c.
|
||||||
* Keep them in alphabeticall order.
|
* Keep them in alphabetical order.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define AGGNAME 0
|
#define AGGNAME 0
|
||||||
@ -60,30 +57,13 @@
|
|||||||
#define TYPENAME 26
|
#define TYPENAME 26
|
||||||
#define TYPEOID 27
|
#define TYPEOID 27
|
||||||
|
|
||||||
/* ----------------
|
|
||||||
* struct cachedesc: information needed for a call to InitSysCache()
|
|
||||||
* ----------------
|
|
||||||
*/
|
|
||||||
struct cachedesc
|
|
||||||
{
|
|
||||||
char *name; /* this is Name so that we can initialize
|
|
||||||
* it */
|
|
||||||
int nkeys;
|
|
||||||
int key[4];
|
|
||||||
int size; /* sizeof(appropriate struct) */
|
|
||||||
char *indname; /* index relation for this cache, if
|
|
||||||
* exists */
|
|
||||||
HeapTuple (*iScanFunc) ();/* function to handle index scans */
|
|
||||||
};
|
|
||||||
|
|
||||||
extern void zerocaches(void);
|
extern void zerocaches(void);
|
||||||
extern void InitCatalogCache(void);
|
extern void InitCatalogCache(void);
|
||||||
extern HeapTuple SearchSysCacheTupleCopy(int cacheId,
|
|
||||||
Datum key1, Datum key2, Datum key3, Datum key4);
|
|
||||||
extern HeapTuple SearchSysCacheTuple(int cacheId,
|
extern HeapTuple SearchSysCacheTuple(int cacheId,
|
||||||
Datum key1, Datum key2, Datum key3, Datum key4);
|
Datum key1, Datum key2, Datum key3, Datum key4);
|
||||||
|
extern HeapTuple SearchSysCacheTupleCopy(int cacheId,
|
||||||
|
Datum key1, Datum key2, Datum key3, Datum key4);
|
||||||
extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup,
|
extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup,
|
||||||
AttrNumber attributeNumber,
|
AttrNumber attributeNumber, bool *isNull);
|
||||||
bool *isnull);
|
|
||||||
|
|
||||||
#endif /* SYSCACHE_H */
|
#endif /* SYSCACHE_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user