88 *
99 *
1010 * IDENTIFICATION
11- * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.51 1999/11/22 17:55:57 momjian Exp $
11+ * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.52 1999/11/24 16:52:31 momjian Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -881,42 +881,77 @@ RewriteOidIndexScan(Relation heapRelation, Oid rewriteId)
881881
882882
883883HeapTuple
884- TypeNameIndexScan (Relation heapRelation ,char * typeName )
884+ ShadowNameIndexScan (Relation heapRelation ,char * useName )
885885{
886886Relation idesc ;
887887ScanKeyData skey [1 ];
888888HeapTuple tuple ;
889-
889+
890890ScanKeyEntryInitialize (& skey [0 ],
891891 (bits16 )0x0 ,
892892 (AttrNumber )1 ,
893893 (RegProcedure )F_NAMEEQ ,
894- PointerGetDatum (typeName ));
894+ PointerGetDatum (useName ));
895895
896- idesc = index_openr (TypeNameIndex );
896+ idesc = index_openr (ShadowNameIndex );
897897tuple = CatalogIndexFetchTuple (heapRelation ,idesc ,skey ,1 );
898898
899899index_close (idesc );
900-
901900return tuple ;
902901}
903902
904903
905904HeapTuple
906- TypeOidIndexScan (Relation heapRelation ,Oid typeId )
905+ ShadowSysidIndexScan (Relation heapRelation ,int4 sysId )
907906{
908907Relation idesc ;
909908ScanKeyData skey [1 ];
910909HeapTuple tuple ;
910+
911+ ScanKeyEntryInitialize (& skey [0 ],
912+ (bits16 )0x0 ,
913+ (AttrNumber )1 ,
914+ (RegProcedure )F_INT4EQ ,
915+ Int32GetDatum (sysId ));
916+
917+ idesc = index_openr (ShadowSysidIndex );
918+ tuple = CatalogIndexFetchTuple (heapRelation ,idesc ,skey ,1 );
919+
920+ index_close (idesc );
921+ return tuple ;
922+ }
923+
924+
925+ HeapTuple
926+ StatisticRelidAttnumOpIndexScan (Relation heapRelation ,
927+ Oid relId ,
928+ AttrNumber attNum ,
929+ Oid op )
930+ {
931+ Relation idesc ;
932+ ScanKeyData skey [3 ];
933+ HeapTuple tuple ;
911934
912935ScanKeyEntryInitialize (& skey [0 ],
913936 (bits16 )0x0 ,
914937 (AttrNumber )1 ,
915938 (RegProcedure )F_OIDEQ ,
916- ObjectIdGetDatum (typeId ));
939+ ObjectIdGetDatum (relId ));
917940
918- idesc = index_openr (TypeOidIndex );
919- tuple = CatalogIndexFetchTuple (heapRelation ,idesc ,skey ,1 );
941+ ScanKeyEntryInitialize (& skey [1 ],
942+ (bits16 )0x0 ,
943+ (AttrNumber )2 ,
944+ (RegProcedure )F_INT2EQ ,
945+ Int16GetDatum (attNum ));
946+
947+ ScanKeyEntryInitialize (& skey [2 ],
948+ (bits16 )0x0 ,
949+ (AttrNumber )3 ,
950+ (RegProcedure )F_OIDEQ ,
951+ ObjectIdGetDatum (op ));
952+
953+ idesc = index_openr (StatisticRelidAttnumOpIndex );
954+ tuple = CatalogIndexFetchTuple (heapRelation ,idesc ,skey ,3 );
920955
921956index_close (idesc );
922957
@@ -925,44 +960,45 @@ TypeOidIndexScan(Relation heapRelation, Oid typeId)
925960
926961
927962HeapTuple
928- ShadowNameIndexScan (Relation heapRelation ,char * useName )
963+ TypeNameIndexScan (Relation heapRelation ,char * typeName )
929964{
930965Relation idesc ;
931966ScanKeyData skey [1 ];
932967HeapTuple tuple ;
933-
968+
934969ScanKeyEntryInitialize (& skey [0 ],
935970 (bits16 )0x0 ,
936971 (AttrNumber )1 ,
937972 (RegProcedure )F_NAMEEQ ,
938- PointerGetDatum (useName ));
973+ PointerGetDatum (typeName ));
939974
940- idesc = index_openr (ShadowNameIndex );
975+ idesc = index_openr (TypeNameIndex );
941976tuple = CatalogIndexFetchTuple (heapRelation ,idesc ,skey ,1 );
942977
943978index_close (idesc );
979+
944980return tuple ;
945981}
946982
947983
948984HeapTuple
949- ShadowSysidIndexScan (Relation heapRelation ,int4 sysId )
985+ TypeOidIndexScan (Relation heapRelation ,Oid typeId )
950986{
951987Relation idesc ;
952988ScanKeyData skey [1 ];
953989HeapTuple tuple ;
954-
990+
955991ScanKeyEntryInitialize (& skey [0 ],
956992 (bits16 )0x0 ,
957993 (AttrNumber )1 ,
958- (RegProcedure )F_INT4EQ ,
959- Int32GetDatum ( sysId ));
994+ (RegProcedure )F_OIDEQ ,
995+ ObjectIdGetDatum ( typeId ));
960996
961- idesc = index_openr (ShadowSysidIndex );
997+ idesc = index_openr (TypeOidIndex );
962998tuple = CatalogIndexFetchTuple (heapRelation ,idesc ,skey ,1 );
963999
9641000index_close (idesc );
1001+
9651002return tuple ;
9661003}
9671004
968-