diff options
Diffstat (limited to 'src/backend/utils/cache/syscache.c')
-rw-r--r-- | src/backend/utils/cache/syscache.c | 71 |
1 files changed, 38 insertions, 33 deletions
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c index 2b381782a32..c26808a8334 100644 --- a/src/backend/utils/cache/syscache.c +++ b/src/backend/utils/cache/syscache.c @@ -147,7 +147,7 @@ static const struct cachedesc cacheinfo[] = { AmOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_am_oid, 0, 0, 0 @@ -246,7 +246,7 @@ static const struct cachedesc cacheinfo[] = { AuthIdOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_authid_oid, 0, 0, 0 @@ -280,7 +280,7 @@ static const struct cachedesc cacheinfo[] = { OpclassOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_opclass_oid, 0, 0, 0 @@ -302,7 +302,7 @@ static const struct cachedesc cacheinfo[] = { CollationOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_collation_oid, 0, 0, 0 @@ -316,7 +316,7 @@ static const struct cachedesc cacheinfo[] = { Anum_pg_conversion_connamespace, Anum_pg_conversion_conforencoding, Anum_pg_conversion_contoencoding, - ObjectIdAttributeNumber, + Anum_pg_conversion_oid }, 8 }, @@ -335,7 +335,7 @@ static const struct cachedesc cacheinfo[] = { ConstraintOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_constraint_oid, 0, 0, 0 @@ -346,7 +346,7 @@ static const struct cachedesc cacheinfo[] = { ConversionOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_conversion_oid, 0, 0, 0 @@ -357,7 +357,7 @@ static const struct cachedesc cacheinfo[] = { DatabaseOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_database_oid, 0, 0, 0 @@ -379,7 +379,7 @@ static const struct cachedesc cacheinfo[] = { EnumOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_enum_oid, 0, 0, 0 @@ -412,7 +412,7 @@ static const struct cachedesc cacheinfo[] = { EventTriggerOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_event_trigger_oid, 0, 0, 0 @@ -434,7 +434,7 @@ static const struct cachedesc cacheinfo[] = { ForeignDataWrapperOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_foreign_data_wrapper_oid, 0, 0, 0 @@ -456,7 +456,7 @@ static const struct cachedesc cacheinfo[] = { ForeignServerOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_foreign_server_oid, 0, 0, 0 @@ -500,7 +500,7 @@ static const struct cachedesc cacheinfo[] = { LanguageOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_language_oid, 0, 0, 0 @@ -522,7 +522,7 @@ static const struct cachedesc cacheinfo[] = { NamespaceOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_namespace_oid, 0, 0, 0 @@ -544,7 +544,7 @@ static const struct cachedesc cacheinfo[] = { OperatorOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_operator_oid, 0, 0, 0 @@ -566,7 +566,7 @@ static const struct cachedesc cacheinfo[] = { OpfamilyOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_opfamily_oid, 0, 0, 0 @@ -599,7 +599,7 @@ static const struct cachedesc cacheinfo[] = { ProcedureOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_proc_oid, 0, 0, 0 @@ -621,7 +621,7 @@ static const struct cachedesc cacheinfo[] = { PublicationObjectIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_publication_oid, 0, 0, 0 @@ -632,7 +632,7 @@ static const struct cachedesc cacheinfo[] = { PublicationRelObjectIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_publication_rel_oid, 0, 0, 0 @@ -676,7 +676,7 @@ static const struct cachedesc cacheinfo[] = { ClassOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_class_oid, 0, 0, 0 @@ -742,7 +742,7 @@ static const struct cachedesc cacheinfo[] = { StatisticExtOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_statistic_ext_oid, 0, 0, 0 @@ -775,7 +775,7 @@ static const struct cachedesc cacheinfo[] = { SubscriptionObjectIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_subscription_oid, 0, 0, 0 @@ -797,7 +797,7 @@ static const struct cachedesc cacheinfo[] = { TablespaceOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_tablespace_oid, 0, 0, 0, @@ -808,7 +808,7 @@ static const struct cachedesc cacheinfo[] = { TransformOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_transform_oid, 0, 0, 0, @@ -852,7 +852,7 @@ static const struct cachedesc cacheinfo[] = { TSConfigOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_ts_config_oid, 0, 0, 0 @@ -874,7 +874,7 @@ static const struct cachedesc cacheinfo[] = { TSDictionaryOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_ts_dict_oid, 0, 0, 0 @@ -896,7 +896,7 @@ static const struct cachedesc cacheinfo[] = { TSParserOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_ts_parser_oid, 0, 0, 0 @@ -918,7 +918,7 @@ static const struct cachedesc cacheinfo[] = { TSTemplateOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_ts_template_oid, 0, 0, 0 @@ -940,7 +940,7 @@ static const struct cachedesc cacheinfo[] = { TypeOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_type_oid, 0, 0, 0 @@ -951,7 +951,7 @@ static const struct cachedesc cacheinfo[] = { UserMappingOidIndexId, 1, { - ObjectIdAttributeNumber, + Anum_pg_user_mapping_oid, 0, 0, 0 @@ -1213,24 +1213,29 @@ SearchSysCacheExists(int cacheId, /* * GetSysCacheOid * - * A convenience routine that does SearchSysCache and returns the OID - * of the found tuple, or InvalidOid if no tuple could be found. + * A convenience routine that does SearchSysCache and returns the OID in the + * oidcol column of the found tuple, or InvalidOid if no tuple could be found. * No lock is retained on the syscache entry. */ Oid GetSysCacheOid(int cacheId, + AttrNumber oidcol, Datum key1, Datum key2, Datum key3, Datum key4) { HeapTuple tuple; + bool isNull; Oid result; tuple = SearchSysCache(cacheId, key1, key2, key3, key4); if (!HeapTupleIsValid(tuple)) return InvalidOid; - result = HeapTupleGetOid(tuple); + result = heap_getattr(tuple, oidcol, + SysCache[cacheId]->cc_tupdesc, + &isNull); + Assert(!isNull); /* columns used as oids should never be NULL */ ReleaseSysCache(tuple); return result; } |