24 #include "catalog/pg_db_role_setting_d.h"
25 #include "catalog/pg_depend_d.h"
26 #include "catalog/pg_description_d.h"
27 #include "catalog/pg_seclabel_d.h"
28 #include "catalog/pg_shdepend_d.h"
29 #include "catalog/pg_shdescription_d.h"
30 #include "catalog/pg_shseclabel_d.h"
79 #define KEY(...) VA_ARGS_NARGS(__VA_ARGS__), { __VA_ARGS__ }
81 #include "catalog/syscache_info.h"
84 "SysCacheSize does not match syscache.c's array");
118 for (cacheId = 0; cacheId < SysCacheSize; cacheId++)
129 cacheinfo[cacheId].reloid,
130 cacheinfo[cacheId].indoid,
131 cacheinfo[cacheId].nkeys,
132 cacheinfo[cacheId].
key,
133 cacheinfo[cacheId].nbuckets);
135 elog(
ERROR,
"could not initialize cache %u (%d)",
136 cacheinfo[cacheId].reloid, cacheId);
139 cacheinfo[cacheId].reloid;
141 cacheinfo[cacheId].reloid;
143 cacheinfo[cacheId].indoid;
186 for (cacheId = 0; cacheId < SysCacheSize; cacheId++)
214 Assert(cacheId >= 0 && cacheId < SysCacheSize &&
224 Assert(cacheId >= 0 && cacheId < SysCacheSize &&
235 Assert(cacheId >= 0 && cacheId < SysCacheSize &&
246 Assert(cacheId >= 0 && cacheId < SysCacheSize &&
257 Assert(cacheId >= 0 && cacheId < SysCacheSize &&
294 Oid reloid = cacheinfo[cacheId].reloid;
606 if (cacheId < 0 || cacheId >= SysCacheSize ||
608 elog(
ERROR,
"invalid cache ID: %d", cacheId);
638 "unexpected null value in cached tuple for catalog %s column %s",
663 if (cacheId < 0 || cacheId >= SysCacheSize ||
665 elog(
ERROR,
"invalid cache ID: %d", cacheId);
677 if (cacheId < 0 || cacheId >= SysCacheSize ||
679 elog(
ERROR,
"invalid cache ID: %d", cacheId);
696 if (cacheId < 0 || cacheId >= SysCacheSize)
697 elog(
ERROR,
"invalid cache ID: %d", cacheId);
722 case DbRoleSettingRelationId:
723 case DependRelationId:
724 case SharedDependRelationId:
725 case DescriptionRelationId:
726 case SharedDescriptionRelationId:
727 case SecLabelRelationId:
728 case SharedSecLabelRelationId:
748 int middle = low + (high - low) / 2;
773 int middle = low + (high - low) / 2;
#define Assert(condition)
#define PointerIsValid(pointer)
#define OidIsValid(objectId)
HeapTuple SearchCatCache2(CatCache *cache, Datum v1, Datum v2)
HeapTuple SearchCatCache3(CatCache *cache, Datum v1, Datum v2, Datum v3)
void InitCatCachePhase2(CatCache *cache, bool touch_index)
uint32 GetCatCacheHashValue(CatCache *cache, Datum v1, Datum v2, Datum v3, Datum v4)
HeapTuple SearchCatCache4(CatCache *cache, Datum v1, Datum v2, Datum v3, Datum v4)
CatCache * InitCatCache(int id, Oid reloid, Oid indexoid, int nkeys, const int *key, int nbuckets)
CatCList * SearchCatCacheList(CatCache *cache, int nkeys, Datum v1, Datum v2, Datum v3)
void CatCacheInvalidate(CatCache *cache, uint32 hashValue)
HeapTuple SearchCatCache1(CatCache *cache, Datum v1)
void ReleaseCatCache(HeapTuple tuple)
HeapTuple SearchCatCache(CatCache *cache, Datum v1, Datum v2, Datum v3, Datum v4)
HeapTuple heap_copytuple(HeapTuple tuple)
#define HeapTupleIsValid(tuple)
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
static int pg_cmp_u32(uint32 a, uint32 b)
void AcceptInvalidationMessages(void)
bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2)
static void ItemPointerSetInvalid(ItemPointerData *pointer)
static OffsetNumber ItemPointerGetOffsetNumber(const ItemPointerData *pointer)
static BlockNumber ItemPointerGetBlockNumber(const ItemPointerData *pointer)
static bool ItemPointerIsValid(const ItemPointerData *pointer)
LockAcquireResult LockAcquire(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock, bool dontWait)
bool LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
#define SET_LOCKTAG_TUPLE(locktag, dboid, reloid, blocknum, offnum)
#define InplaceUpdateTupleLock
char * get_rel_name(Oid relid)
FormData_pg_attribute * Form_pg_attribute
#define qsort(a, b, c, d)
static Datum Int16GetDatum(int16 X)
static Datum ObjectIdGetDatum(Oid X)
static Datum CStringGetDatum(const char *X)
static size_t qunique(void *array, size_t elements, size_t width, int(*compare)(const void *, const void *))
HeapTuple SearchSysCacheCopyAttName(Oid relid, const char *attname)
void SysCacheInvalidate(int cacheId, uint32 hashValue)
bool RelationHasSysCache(Oid relid)
HeapTuple SearchSysCacheCopyAttNum(Oid relid, int16 attnum)
void InitCatalogCache(void)
void ReleaseSysCache(HeapTuple tuple)
static bool CacheInitialized
HeapTuple SearchSysCacheLocked1(int cacheId, Datum key1)
HeapTuple SearchSysCacheLockedCopy1(int cacheId, Datum key1)
static int oid_compare(const void *a, const void *b)
HeapTuple SearchSysCache(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
uint32 GetSysCacheHashValue(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
struct catclist * SearchSysCacheList(int cacheId, int nkeys, Datum key1, Datum key2, Datum key3)
StaticAssertDecl(lengthof(cacheinfo)==SysCacheSize, "SysCacheSize does not match syscache.c's array")
HeapTuple SearchSysCache3(int cacheId, Datum key1, Datum key2, Datum key3)
static int SysCacheSupportingRelOidSize
HeapTuple SearchSysCacheAttNum(Oid relid, int16 attnum)
bool RelationSupportsSysCache(Oid relid)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
bool SearchSysCacheExistsAttName(Oid relid, const char *attname)
void InitCatalogCachePhase2(void)
HeapTuple SearchSysCache2(int cacheId, Datum key1, Datum key2)
HeapTuple SearchSysCacheAttName(Oid relid, const char *attname)
bool SearchSysCacheExists(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
HeapTuple SearchSysCacheCopy(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
static Oid SysCacheRelationOid[SysCacheSize]
static CatCache * SysCache[SysCacheSize]
static Oid SysCacheSupportingRelOid[SysCacheSize *2]
static int SysCacheRelationOidSize
bool RelationInvalidatesSnapshotsOnly(Oid relid)
HeapTuple SearchSysCache4(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, AttrNumber attributeNumber)
Oid GetSysCacheOid(int cacheId, AttrNumber oidcol, Datum key1, Datum key2, Datum key3, Datum key4)
#define TupleDescAttr(tupdesc, i)