8
8
*
9
9
*
10
10
* 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 $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -881,42 +881,77 @@ RewriteOidIndexScan(Relation heapRelation, Oid rewriteId)
881
881
882
882
883
883
HeapTuple
884
- TypeNameIndexScan (Relation heapRelation ,char * typeName )
884
+ ShadowNameIndexScan (Relation heapRelation ,char * useName )
885
885
{
886
886
Relation idesc ;
887
887
ScanKeyData skey [1 ];
888
888
HeapTuple tuple ;
889
-
889
+
890
890
ScanKeyEntryInitialize (& skey [0 ],
891
891
(bits16 )0x0 ,
892
892
(AttrNumber )1 ,
893
893
(RegProcedure )F_NAMEEQ ,
894
- PointerGetDatum (typeName ));
894
+ PointerGetDatum (useName ));
895
895
896
- idesc = index_openr (TypeNameIndex );
896
+ idesc = index_openr (ShadowNameIndex );
897
897
tuple = CatalogIndexFetchTuple (heapRelation ,idesc ,skey ,1 );
898
898
899
899
index_close (idesc );
900
-
901
900
return tuple ;
902
901
}
903
902
904
903
905
904
HeapTuple
906
- TypeOidIndexScan (Relation heapRelation ,Oid typeId )
905
+ ShadowSysidIndexScan (Relation heapRelation ,int4 sysId )
907
906
{
908
907
Relation idesc ;
909
908
ScanKeyData skey [1 ];
910
909
HeapTuple 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 ;
911
934
912
935
ScanKeyEntryInitialize (& skey [0 ],
913
936
(bits16 )0x0 ,
914
937
(AttrNumber )1 ,
915
938
(RegProcedure )F_OIDEQ ,
916
- ObjectIdGetDatum (typeId ));
939
+ ObjectIdGetDatum (relId ));
917
940
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 );
920
955
921
956
index_close (idesc );
922
957
@@ -925,44 +960,45 @@ TypeOidIndexScan(Relation heapRelation, Oid typeId)
925
960
926
961
927
962
HeapTuple
928
- ShadowNameIndexScan (Relation heapRelation ,char * useName )
963
+ TypeNameIndexScan (Relation heapRelation ,char * typeName )
929
964
{
930
965
Relation idesc ;
931
966
ScanKeyData skey [1 ];
932
967
HeapTuple tuple ;
933
-
968
+
934
969
ScanKeyEntryInitialize (& skey [0 ],
935
970
(bits16 )0x0 ,
936
971
(AttrNumber )1 ,
937
972
(RegProcedure )F_NAMEEQ ,
938
- PointerGetDatum (useName ));
973
+ PointerGetDatum (typeName ));
939
974
940
- idesc = index_openr (ShadowNameIndex );
975
+ idesc = index_openr (TypeNameIndex );
941
976
tuple = CatalogIndexFetchTuple (heapRelation ,idesc ,skey ,1 );
942
977
943
978
index_close (idesc );
979
+
944
980
return tuple ;
945
981
}
946
982
947
983
948
984
HeapTuple
949
- ShadowSysidIndexScan (Relation heapRelation ,int4 sysId )
985
+ TypeOidIndexScan (Relation heapRelation ,Oid typeId )
950
986
{
951
987
Relation idesc ;
952
988
ScanKeyData skey [1 ];
953
989
HeapTuple tuple ;
954
-
990
+
955
991
ScanKeyEntryInitialize (& skey [0 ],
956
992
(bits16 )0x0 ,
957
993
(AttrNumber )1 ,
958
- (RegProcedure )F_INT4EQ ,
959
- Int32GetDatum ( sysId ));
994
+ (RegProcedure )F_OIDEQ ,
995
+ ObjectIdGetDatum ( typeId ));
960
996
961
- idesc = index_openr (ShadowSysidIndex );
997
+ idesc = index_openr (TypeOidIndex );
962
998
tuple = CatalogIndexFetchTuple (heapRelation ,idesc ,skey ,1 );
963
999
964
1000
index_close (idesc );
1001
+
965
1002
return tuple ;
966
1003
}
967
1004
968
-