PostgreSQL Source Code  git master
syscache.h File Reference
#include "access/attnum.h"
#include "access/htup.h"
Include dependency graph for syscache.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SysCacheSize   (USERMAPPINGUSERSERVER + 1)
 
#define SearchSysCacheCopy1(cacheId, key1)    SearchSysCacheCopy(cacheId, key1, 0, 0, 0)
 
#define SearchSysCacheCopy2(cacheId, key1, key2)    SearchSysCacheCopy(cacheId, key1, key2, 0, 0)
 
#define SearchSysCacheCopy3(cacheId, key1, key2, key3)    SearchSysCacheCopy(cacheId, key1, key2, key3, 0)
 
#define SearchSysCacheCopy4(cacheId, key1, key2, key3, key4)    SearchSysCacheCopy(cacheId, key1, key2, key3, key4)
 
#define SearchSysCacheExists1(cacheId, key1)    SearchSysCacheExists(cacheId, key1, 0, 0, 0)
 
#define SearchSysCacheExists2(cacheId, key1, key2)    SearchSysCacheExists(cacheId, key1, key2, 0, 0)
 
#define SearchSysCacheExists3(cacheId, key1, key2, key3)    SearchSysCacheExists(cacheId, key1, key2, key3, 0)
 
#define SearchSysCacheExists4(cacheId, key1, key2, key3, key4)    SearchSysCacheExists(cacheId, key1, key2, key3, key4)
 
#define GetSysCacheOid1(cacheId, oidcol, key1)    GetSysCacheOid(cacheId, oidcol, key1, 0, 0, 0)
 
#define GetSysCacheOid2(cacheId, oidcol, key1, key2)    GetSysCacheOid(cacheId, oidcol, key1, key2, 0, 0)
 
#define GetSysCacheOid3(cacheId, oidcol, key1, key2, key3)    GetSysCacheOid(cacheId, oidcol, key1, key2, key3, 0)
 
#define GetSysCacheOid4(cacheId, oidcol, key1, key2, key3, key4)    GetSysCacheOid(cacheId, oidcol, key1, key2, key3, key4)
 
#define GetSysCacheHashValue1(cacheId, key1)    GetSysCacheHashValue(cacheId, key1, 0, 0, 0)
 
#define GetSysCacheHashValue2(cacheId, key1, key2)    GetSysCacheHashValue(cacheId, key1, key2, 0, 0)
 
#define GetSysCacheHashValue3(cacheId, key1, key2, key3)    GetSysCacheHashValue(cacheId, key1, key2, key3, 0)
 
#define GetSysCacheHashValue4(cacheId, key1, key2, key3, key4)    GetSysCacheHashValue(cacheId, key1, key2, key3, key4)
 
#define SearchSysCacheList1(cacheId, key1)    SearchSysCacheList(cacheId, 1, key1, 0, 0)
 
#define SearchSysCacheList2(cacheId, key1, key2)    SearchSysCacheList(cacheId, 2, key1, key2, 0)
 
#define SearchSysCacheList3(cacheId, key1, key2, key3)    SearchSysCacheList(cacheId, 3, key1, key2, key3)
 
#define ReleaseSysCacheList(x)   ReleaseCatCacheList(x)
 

Enumerations

enum  SysCacheIdentifier {
  AGGFNOID = 0 , AMNAME , AMOID , AMOPOPID ,
  AMOPSTRATEGY , AMPROCNUM , ATTNAME , ATTNUM ,
  AUTHMEMMEMROLE , AUTHMEMROLEMEM , AUTHNAME , AUTHOID ,
  CASTSOURCETARGET , CLAAMNAMENSP , CLAOID , COLLNAMEENCNSP ,
  COLLOID , CONDEFAULT , CONNAMENSP , CONSTROID ,
  CONVOID , DATABASEOID , DEFACLROLENSPOBJ , ENUMOID ,
  ENUMTYPOIDNAME , EVENTTRIGGERNAME , EVENTTRIGGEROID , FOREIGNDATAWRAPPERNAME ,
  FOREIGNDATAWRAPPEROID , FOREIGNSERVERNAME , FOREIGNSERVEROID , FOREIGNTABLEREL ,
  INDEXRELID , LANGNAME , LANGOID , NAMESPACENAME ,
  NAMESPACEOID , OPERNAMENSP , OPEROID , OPFAMILYAMNAMENSP ,
  OPFAMILYOID , PARAMETERACLNAME , PARAMETERACLOID , PARTRELID ,
  PROCNAMEARGSNSP , PROCOID , PUBLICATIONNAME , PUBLICATIONNAMESPACE ,
  PUBLICATIONNAMESPACEMAP , PUBLICATIONOID , PUBLICATIONREL , PUBLICATIONRELMAP ,
  RANGEMULTIRANGE , RANGETYPE , RELNAMENSP , RELOID ,
  REPLORIGIDENT , REPLORIGNAME , RULERELNAME , SEQRELID ,
  STATEXTDATASTXOID , STATEXTNAMENSP , STATEXTOID , STATRELATTINH ,
  SUBSCRIPTIONNAME , SUBSCRIPTIONOID , SUBSCRIPTIONRELMAP , TABLESPACEOID ,
  TRFOID , TRFTYPELANG , TSCONFIGMAP , TSCONFIGNAMENSP ,
  TSCONFIGOID , TSDICTNAMENSP , TSDICTOID , TSPARSERNAMENSP ,
  TSPARSEROID , TSTEMPLATENAMENSP , TSTEMPLATEOID , TYPENAMENSP ,
  TYPEOID , USERMAPPINGOID
}
 

Functions

void InitCatalogCache (void)
 
void InitCatalogCachePhase2 (void)
 
HeapTuple SearchSysCache (int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
 
HeapTuple SearchSysCache1 (int cacheId, Datum key1)
 
HeapTuple SearchSysCache2 (int cacheId, Datum key1, Datum key2)
 
HeapTuple SearchSysCache3 (int cacheId, Datum key1, Datum key2, Datum key3)
 
HeapTuple SearchSysCache4 (int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
 
void ReleaseSysCache (HeapTuple tuple)
 
HeapTuple SearchSysCacheCopy (int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
 
bool SearchSysCacheExists (int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
 
Oid GetSysCacheOid (int cacheId, AttrNumber oidcol, Datum key1, Datum key2, Datum key3, Datum key4)
 
HeapTuple SearchSysCacheAttName (Oid relid, const char *attname)
 
HeapTuple SearchSysCacheCopyAttName (Oid relid, const char *attname)
 
bool SearchSysCacheExistsAttName (Oid relid, const char *attname)
 
HeapTuple SearchSysCacheAttNum (Oid relid, int16 attnum)
 
HeapTuple SearchSysCacheCopyAttNum (Oid relid, int16 attnum)
 
Datum SysCacheGetAttr (int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
 
Datum SysCacheGetAttrNotNull (int cacheId, HeapTuple tup, AttrNumber attributeNumber)
 
uint32 GetSysCacheHashValue (int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
 
struct catclistSearchSysCacheList (int cacheId, int nkeys, Datum key1, Datum key2, Datum key3)
 
void SysCacheInvalidate (int cacheId, uint32 hashValue)
 
bool RelationInvalidatesSnapshotsOnly (Oid relid)
 
bool RelationHasSysCache (Oid relid)
 
bool RelationSupportsSysCache (Oid relid)
 

Macro Definition Documentation

◆ GetSysCacheHashValue1

#define GetSysCacheHashValue1 (   cacheId,
  key1 
)     GetSysCacheHashValue(cacheId, key1, 0, 0, 0)

Definition at line 209 of file syscache.h.

◆ GetSysCacheHashValue2

#define GetSysCacheHashValue2 (   cacheId,
  key1,
  key2 
)     GetSysCacheHashValue(cacheId, key1, key2, 0, 0)

Definition at line 211 of file syscache.h.

◆ GetSysCacheHashValue3

#define GetSysCacheHashValue3 (   cacheId,
  key1,
  key2,
  key3 
)     GetSysCacheHashValue(cacheId, key1, key2, key3, 0)

Definition at line 213 of file syscache.h.

◆ GetSysCacheHashValue4

#define GetSysCacheHashValue4 (   cacheId,
  key1,
  key2,
  key3,
  key4 
)     GetSysCacheHashValue(cacheId, key1, key2, key3, key4)

Definition at line 215 of file syscache.h.

◆ GetSysCacheOid1

#define GetSysCacheOid1 (   cacheId,
  oidcol,
  key1 
)     GetSysCacheOid(cacheId, oidcol, key1, 0, 0, 0)

Definition at line 200 of file syscache.h.

◆ GetSysCacheOid2

#define GetSysCacheOid2 (   cacheId,
  oidcol,
  key1,
  key2 
)     GetSysCacheOid(cacheId, oidcol, key1, key2, 0, 0)

Definition at line 202 of file syscache.h.

◆ GetSysCacheOid3

#define GetSysCacheOid3 (   cacheId,
  oidcol,
  key1,
  key2,
  key3 
)     GetSysCacheOid(cacheId, oidcol, key1, key2, key3, 0)

Definition at line 204 of file syscache.h.

◆ GetSysCacheOid4

#define GetSysCacheOid4 (   cacheId,
  oidcol,
  key1,
  key2,
  key3,
  key4 
)     GetSysCacheOid(cacheId, oidcol, key1, key2, key3, key4)

Definition at line 206 of file syscache.h.

◆ ReleaseSysCacheList

#define ReleaseSysCacheList (   x)    ReleaseCatCacheList(x)

Definition at line 225 of file syscache.h.

◆ SearchSysCacheCopy1

#define SearchSysCacheCopy1 (   cacheId,
  key1 
)     SearchSysCacheCopy(cacheId, key1, 0, 0, 0)

Definition at line 182 of file syscache.h.

◆ SearchSysCacheCopy2

#define SearchSysCacheCopy2 (   cacheId,
  key1,
  key2 
)     SearchSysCacheCopy(cacheId, key1, key2, 0, 0)

Definition at line 184 of file syscache.h.

◆ SearchSysCacheCopy3

#define SearchSysCacheCopy3 (   cacheId,
  key1,
  key2,
  key3 
)     SearchSysCacheCopy(cacheId, key1, key2, key3, 0)

Definition at line 186 of file syscache.h.

◆ SearchSysCacheCopy4

#define SearchSysCacheCopy4 (   cacheId,
  key1,
  key2,
  key3,
  key4 
)     SearchSysCacheCopy(cacheId, key1, key2, key3, key4)

Definition at line 188 of file syscache.h.

◆ SearchSysCacheExists1

#define SearchSysCacheExists1 (   cacheId,
  key1 
)     SearchSysCacheExists(cacheId, key1, 0, 0, 0)

Definition at line 191 of file syscache.h.

◆ SearchSysCacheExists2

#define SearchSysCacheExists2 (   cacheId,
  key1,
  key2 
)     SearchSysCacheExists(cacheId, key1, key2, 0, 0)

Definition at line 193 of file syscache.h.

◆ SearchSysCacheExists3

#define SearchSysCacheExists3 (   cacheId,
  key1,
  key2,
  key3 
)     SearchSysCacheExists(cacheId, key1, key2, key3, 0)

Definition at line 195 of file syscache.h.

◆ SearchSysCacheExists4

#define SearchSysCacheExists4 (   cacheId,
  key1,
  key2,
  key3,
  key4 
)     SearchSysCacheExists(cacheId, key1, key2, key3, key4)

Definition at line 197 of file syscache.h.

◆ SearchSysCacheList1

#define SearchSysCacheList1 (   cacheId,
  key1 
)     SearchSysCacheList(cacheId, 1, key1, 0, 0)

Definition at line 218 of file syscache.h.

◆ SearchSysCacheList2

#define SearchSysCacheList2 (   cacheId,
  key1,
  key2 
)     SearchSysCacheList(cacheId, 2, key1, key2, 0)

Definition at line 220 of file syscache.h.

◆ SearchSysCacheList3

#define SearchSysCacheList3 (   cacheId,
  key1,
  key2,
  key3 
)     SearchSysCacheList(cacheId, 3, key1, key2, key3)

Definition at line 222 of file syscache.h.

◆ SysCacheSize

#define SysCacheSize   (USERMAPPINGUSERSERVER + 1)

Definition at line 118 of file syscache.h.

Enumeration Type Documentation

◆ SysCacheIdentifier

Enumerator
AGGFNOID 
AMNAME 
AMOID 
AMOPOPID 
AMOPSTRATEGY 
AMPROCNUM 
ATTNAME 
ATTNUM 
AUTHMEMMEMROLE 
AUTHMEMROLEMEM 
AUTHNAME 
AUTHOID 
CASTSOURCETARGET 
CLAAMNAMENSP 
CLAOID 
COLLNAMEENCNSP 
COLLOID 
CONDEFAULT 
CONNAMENSP 
CONSTROID 
CONVOID 
DATABASEOID 
DEFACLROLENSPOBJ 
ENUMOID 
ENUMTYPOIDNAME 
EVENTTRIGGERNAME 
EVENTTRIGGEROID 
FOREIGNDATAWRAPPERNAME 
FOREIGNDATAWRAPPEROID 
FOREIGNSERVERNAME 
FOREIGNSERVEROID 
FOREIGNTABLEREL 
INDEXRELID 
LANGNAME 
LANGOID 
NAMESPACENAME 
NAMESPACEOID 
OPERNAMENSP 
OPEROID 
OPFAMILYAMNAMENSP 
OPFAMILYOID 
PARAMETERACLNAME 
PARAMETERACLOID 
PARTRELID 
PROCNAMEARGSNSP 
PROCOID 
PUBLICATIONNAME 
PUBLICATIONNAMESPACE 
PUBLICATIONNAMESPACEMAP 
PUBLICATIONOID 
PUBLICATIONREL 
PUBLICATIONRELMAP 
RANGEMULTIRANGE 
RANGETYPE 
RELNAMENSP 
RELOID 
REPLORIGIDENT 
REPLORIGNAME 
RULERELNAME 
SEQRELID 
STATEXTDATASTXOID 
STATEXTNAMENSP 
STATEXTOID 
STATRELATTINH 
SUBSCRIPTIONNAME 
SUBSCRIPTIONOID 
SUBSCRIPTIONRELMAP 
TABLESPACEOID 
TRFOID 
TRFTYPELANG 
TSCONFIGMAP 
TSCONFIGNAMENSP 
TSCONFIGOID 
TSDICTNAMENSP 
TSDICTOID 
TSPARSERNAMENSP 
TSPARSEROID 
TSTEMPLATENAMENSP 
TSTEMPLATEOID 
TYPENAMENSP 
TYPEOID 
USERMAPPINGOID 

Definition at line 32 of file syscache.h.

33 {
34  AGGFNOID = 0,
35  AMNAME,
36  AMOID,
37  AMOPOPID,
39  AMPROCNUM,
40  ATTNAME,
41  ATTNUM,
44  AUTHNAME,
45  AUTHOID,
48  CLAOID,
50  COLLOID,
51  CONDEFAULT,
52  CONNAMENSP,
53  CONSTROID,
54  CONVOID,
57  ENUMOID,
66  INDEXRELID,
67  LANGNAME,
68  LANGOID,
72  OPEROID,
77  PARTRELID,
79  PROCOID,
87  RANGETYPE,
88  RELNAMENSP,
89  RELOID,
93  SEQRELID,
96  STATEXTOID,
102  TRFOID,
103  TRFTYPELANG,
104  TSCONFIGMAP,
106  TSCONFIGOID,
108  TSDICTOID,
110  TSPARSEROID,
113  TYPENAMENSP,
114  TYPEOID,
116  USERMAPPINGUSERSERVER
117 
118 #define SysCacheSize (USERMAPPINGUSERSERVER + 1)
119 };
@ FOREIGNTABLEREL
Definition: syscache.h:65
@ PARAMETERACLOID
Definition: syscache.h:76
@ RULERELNAME
Definition: syscache.h:92
@ FOREIGNSERVEROID
Definition: syscache.h:64
@ FOREIGNSERVERNAME
Definition: syscache.h:63
@ RANGETYPE
Definition: syscache.h:87
@ TSTEMPLATEOID
Definition: syscache.h:112
@ TSDICTOID
Definition: syscache.h:108
@ OPFAMILYOID
Definition: syscache.h:74
@ STATRELATTINH
Definition: syscache.h:97
@ PUBLICATIONREL
Definition: syscache.h:84
@ REPLORIGIDENT
Definition: syscache.h:90
@ CONNAMENSP
Definition: syscache.h:52
@ SUBSCRIPTIONNAME
Definition: syscache.h:98
@ STATEXTOID
Definition: syscache.h:96
@ TSPARSERNAMENSP
Definition: syscache.h:109
@ OPERNAMENSP
Definition: syscache.h:71
@ TYPEOID
Definition: syscache.h:114
@ TRFTYPELANG
Definition: syscache.h:103
@ AGGFNOID
Definition: syscache.h:34
@ AMNAME
Definition: syscache.h:35
@ AMOID
Definition: syscache.h:36
@ OPEROID
Definition: syscache.h:72
@ TSTEMPLATENAMENSP
Definition: syscache.h:111
@ PROCOID
Definition: syscache.h:79
@ RANGEMULTIRANGE
Definition: syscache.h:86
@ CONDEFAULT
Definition: syscache.h:51
@ AUTHOID
Definition: syscache.h:45
@ EVENTTRIGGEROID
Definition: syscache.h:60
@ TSCONFIGMAP
Definition: syscache.h:104
@ TSCONFIGNAMENSP
Definition: syscache.h:105
@ STATEXTNAMENSP
Definition: syscache.h:95
@ ATTNAME
Definition: syscache.h:40
@ INDEXRELID
Definition: syscache.h:66
@ AUTHNAME
Definition: syscache.h:44
@ PUBLICATIONOID
Definition: syscache.h:83
@ CONVOID
Definition: syscache.h:54
@ ATTNUM
Definition: syscache.h:41
@ RELOID
Definition: syscache.h:89
@ SUBSCRIPTIONRELMAP
Definition: syscache.h:100
@ PUBLICATIONNAME
Definition: syscache.h:80
@ PUBLICATIONNAMESPACE
Definition: syscache.h:81
@ RELNAMENSP
Definition: syscache.h:88
@ TABLESPACEOID
Definition: syscache.h:101
@ CASTSOURCETARGET
Definition: syscache.h:46
@ TYPENAMENSP
Definition: syscache.h:113
@ COLLOID
Definition: syscache.h:50
@ COLLNAMEENCNSP
Definition: syscache.h:49
@ TRFOID
Definition: syscache.h:102
@ CLAOID
Definition: syscache.h:48
@ AUTHMEMROLEMEM
Definition: syscache.h:43
@ ENUMTYPOIDNAME
Definition: syscache.h:58
@ PUBLICATIONNAMESPACEMAP
Definition: syscache.h:82
@ PUBLICATIONRELMAP
Definition: syscache.h:85
@ SUBSCRIPTIONOID
Definition: syscache.h:99
@ LANGNAME
Definition: syscache.h:67
@ EVENTTRIGGERNAME
Definition: syscache.h:59
@ PARAMETERACLNAME
Definition: syscache.h:75
@ FOREIGNDATAWRAPPEROID
Definition: syscache.h:62
@ USERMAPPINGOID
Definition: syscache.h:115
@ REPLORIGNAME
Definition: syscache.h:91
@ AUTHMEMMEMROLE
Definition: syscache.h:42
@ DEFACLROLENSPOBJ
Definition: syscache.h:56
@ AMOPOPID
Definition: syscache.h:37
@ CLAAMNAMENSP
Definition: syscache.h:47
@ DATABASEOID
Definition: syscache.h:55
@ OPFAMILYAMNAMENSP
Definition: syscache.h:73
@ AMPROCNUM
Definition: syscache.h:39
@ FOREIGNDATAWRAPPERNAME
Definition: syscache.h:61
@ ENUMOID
Definition: syscache.h:57
@ AMOPSTRATEGY
Definition: syscache.h:38
@ TSPARSEROID
Definition: syscache.h:110
@ PARTRELID
Definition: syscache.h:77
@ PROCNAMEARGSNSP
Definition: syscache.h:78
@ TSCONFIGOID
Definition: syscache.h:106
@ TSDICTNAMENSP
Definition: syscache.h:107
@ LANGOID
Definition: syscache.h:68
@ NAMESPACEOID
Definition: syscache.h:70
@ CONSTROID
Definition: syscache.h:53
@ STATEXTDATASTXOID
Definition: syscache.h:94
@ NAMESPACENAME
Definition: syscache.h:69
@ SEQRELID
Definition: syscache.h:93

Function Documentation

◆ GetSysCacheHashValue()

uint32 GetSysCacheHashValue ( int  cacheId,
Datum  key1,
Datum  key2,
Datum  key3,
Datum  key4 
)

Definition at line 1140 of file syscache.c.

1145 {
1146  if (cacheId < 0 || cacheId >= SysCacheSize ||
1147  !PointerIsValid(SysCache[cacheId]))
1148  elog(ERROR, "invalid cache ID: %d", cacheId);
1149 
1150  return GetCatCacheHashValue(SysCache[cacheId], key1, key2, key3, key4);
1151 }
#define PointerIsValid(pointer)
Definition: c.h:747
uint32 GetCatCacheHashValue(CatCache *cache, Datum v1, Datum v2, Datum v3, Datum v4)
Definition: catcache.c:1467
#define ERROR
Definition: elog.h:39
static CatCache * SysCache[SysCacheSize]
Definition: syscache.c:685
#define SysCacheSize
Definition: syscache.h:118

References elog(), ERROR, GetCatCacheHashValue(), PointerIsValid, SysCache, and SysCacheSize.

◆ GetSysCacheOid()

Oid GetSysCacheOid ( int  cacheId,
AttrNumber  oidcol,
Datum  key1,
Datum  key2,
Datum  key3,
Datum  key4 
)

Definition at line 927 of file syscache.c.

933 {
934  HeapTuple tuple;
935  bool isNull;
936  Oid result;
937 
938  tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
939  if (!HeapTupleIsValid(tuple))
940  return InvalidOid;
941  result = heap_getattr(tuple, oidcol,
942  SysCache[cacheId]->cc_tupdesc,
943  &isNull);
944  Assert(!isNull); /* columns used as oids should never be NULL */
945  ReleaseSysCache(tuple);
946  return result;
947 }
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
Definition: htup_details.h:792
Assert(fmt[strlen(fmt) - 1] !='\n')
#define InvalidOid
Definition: postgres_ext.h:36
unsigned int Oid
Definition: postgres_ext.h:31
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:866
HeapTuple SearchSysCache(int cacheId, Datum key1, Datum key2, Datum key3, Datum key4)
Definition: syscache.c:805

References Assert(), heap_getattr(), HeapTupleIsValid, InvalidOid, ReleaseSysCache(), SearchSysCache(), and SysCache.

◆ InitCatalogCache()

void InitCatalogCache ( void  )

Definition at line 709 of file syscache.c.

710 {
711  int cacheId;
712 
714 
716 
717  for (cacheId = 0; cacheId < SysCacheSize; cacheId++)
718  {
719  /*
720  * Assert that every enumeration value defined in syscache.h has been
721  * populated in the cacheinfo array.
722  */
723  Assert(cacheinfo[cacheId].reloid != 0);
724 
725  SysCache[cacheId] = InitCatCache(cacheId,
726  cacheinfo[cacheId].reloid,
727  cacheinfo[cacheId].indoid,
728  cacheinfo[cacheId].nkeys,
729  cacheinfo[cacheId].key,
730  cacheinfo[cacheId].nbuckets);
731  if (!PointerIsValid(SysCache[cacheId]))
732  elog(ERROR, "could not initialize cache %u (%d)",
733  cacheinfo[cacheId].reloid, cacheId);
734  /* Accumulate data for OID lists, too */
736  cacheinfo[cacheId].reloid;
738  cacheinfo[cacheId].reloid;
740  cacheinfo[cacheId].indoid;
741  /* see comments for RelationInvalidatesSnapshotsOnly */
743  }
744 
747 
748  /* Sort and de-dup OID arrays, so we can use binary search. */
750  sizeof(Oid), oid_compare);
753  oid_compare);
754 
756  sizeof(Oid), oid_compare);
759  sizeof(Oid), oid_compare);
760 
761  CacheInitialized = true;
762 }
#define lengthof(array)
Definition: c.h:772
CatCache * InitCatCache(int id, Oid reloid, Oid indexoid, int nkeys, const int *key, int nbuckets)
Definition: catcache.c:757
void pg_qsort(void *base, size_t nel, size_t elsize, int(*cmp)(const void *, const void *))
static size_t qunique(void *array, size_t elements, size_t width, int(*compare)(const void *, const void *))
Definition: qunique.h:21
Oid indoid
Definition: syscache.c:120
Oid reloid
Definition: syscache.c:119
static const struct cachedesc cacheinfo[]
Definition: syscache.c:129
static bool CacheInitialized
Definition: syscache.c:687
static int oid_compare(const void *a, const void *b)
Definition: syscache.c:1274
static int SysCacheSupportingRelOidSize
Definition: syscache.c:695
static Oid SysCacheRelationOid[SysCacheSize]
Definition: syscache.c:690
static Oid SysCacheSupportingRelOid[SysCacheSize *2]
Definition: syscache.c:694
static int SysCacheRelationOidSize
Definition: syscache.c:691
bool RelationInvalidatesSnapshotsOnly(Oid relid)
Definition: syscache.c:1201

References Assert(), cacheinfo, CacheInitialized, elog(), ERROR, cachedesc::indoid, InitCatCache(), sort-test::key, lengthof, cachedesc::nbuckets, cachedesc::nkeys, oid_compare(), pg_qsort(), PointerIsValid, qunique(), RelationInvalidatesSnapshotsOnly(), cachedesc::reloid, SysCache, SysCacheRelationOid, SysCacheRelationOidSize, SysCacheSize, SysCacheSupportingRelOid, and SysCacheSupportingRelOidSize.

Referenced by InitPostgres().

◆ InitCatalogCachePhase2()

void InitCatalogCachePhase2 ( void  )

Definition at line 777 of file syscache.c.

778 {
779  int cacheId;
780 
782 
783  for (cacheId = 0; cacheId < SysCacheSize; cacheId++)
784  InitCatCachePhase2(SysCache[cacheId], true);
785 }
void InitCatCachePhase2(CatCache *cache, bool touch_index)
Definition: catcache.c:1025

References Assert(), CacheInitialized, InitCatCachePhase2(), SysCache, and SysCacheSize.

Referenced by RelationCacheInitializePhase3().

◆ RelationHasSysCache()

bool RelationHasSysCache ( Oid  relid)

Definition at line 1224 of file syscache.c.

1225 {
1226  int low = 0,
1227  high = SysCacheRelationOidSize - 1;
1228 
1229  while (low <= high)
1230  {
1231  int middle = low + (high - low) / 2;
1232 
1233  if (SysCacheRelationOid[middle] == relid)
1234  return true;
1235  if (SysCacheRelationOid[middle] < relid)
1236  low = middle + 1;
1237  else
1238  high = middle - 1;
1239  }
1240 
1241  return false;
1242 }

References SysCacheRelationOid, and SysCacheRelationOidSize.

Referenced by GetNonHistoricCatalogSnapshot().

◆ RelationInvalidatesSnapshotsOnly()

bool RelationInvalidatesSnapshotsOnly ( Oid  relid)

Definition at line 1201 of file syscache.c.

1202 {
1203  switch (relid)
1204  {
1205  case DbRoleSettingRelationId:
1206  case DependRelationId:
1207  case SharedDependRelationId:
1208  case DescriptionRelationId:
1209  case SharedDescriptionRelationId:
1210  case SecLabelRelationId:
1211  case SharedSecLabelRelationId:
1212  return true;
1213  default:
1214  break;
1215  }
1216 
1217  return false;
1218 }

Referenced by CacheInvalidateHeapTuple(), GetNonHistoricCatalogSnapshot(), and InitCatalogCache().

◆ RelationSupportsSysCache()

bool RelationSupportsSysCache ( Oid  relid)

Definition at line 1249 of file syscache.c.

1250 {
1251  int low = 0,
1252  high = SysCacheSupportingRelOidSize - 1;
1253 
1254  while (low <= high)
1255  {
1256  int middle = low + (high - low) / 2;
1257 
1258  if (SysCacheSupportingRelOid[middle] == relid)
1259  return true;
1260  if (SysCacheSupportingRelOid[middle] < relid)
1261  low = middle + 1;
1262  else
1263  high = middle - 1;
1264  }
1265 
1266  return false;
1267 }

References SysCacheSupportingRelOid, and SysCacheSupportingRelOidSize.

Referenced by RelationIdIsInInitFile().

◆ ReleaseSysCache()

void ReleaseSysCache ( HeapTuple  tuple)

Definition at line 866 of file syscache.c.

867 {
868  ReleaseCatCache(tuple);
869 }
void ReleaseCatCache(HeapTuple tuple)
Definition: catcache.c:1435

References ReleaseCatCache().

Referenced by aclitemout(), add_cast_to(), add_function_cost(), AddEnumLabel(), AddRoleMems(), agg_args_support_sendreceive(), AggregateCreate(), AlterDomainValidateConstraint(), AlterEnum(), AlterObjectRename_internal(), AlterOpFamily(), AlterPublicationOptions(), AlterPublicationSchemas(), AlterPublicationTables(), AlterRole(), AlterRoleSet(), AlterSchemaOwner(), AlterSchemaOwner_oid(), AlterStatistics(), AlterTSConfiguration(), AlterTSDictionary(), AlterType(), AlterTypeOwner(), AlterTypeOwner_oid(), AlterTypeRecurse(), amvalidate(), appendFunctionName(), appendOrderBySuffix(), assignOperTypes(), assignProcTypes(), ATAddForeignKeyConstraint(), ATDetachCheckNoForeignKeyRefs(), ATExecAddColumn(), ATExecAddOf(), ATExecAlterColumnGenericOptions(), ATExecAlterColumnType(), ATExecAlterConstraint(), ATExecChangeOwner(), ATExecCheckNotNull(), ATExecDropColumn(), ATExecDropNotNull(), ATExecSetOptions(), ATExecSetRelOptions(), ATPostAlterTypeCleanup(), ATPrepAlterColumnType(), ATPrepSetNotNull(), blvalidate(), brincostestimate(), brinvalidate(), btcostestimate(), btvalidate(), build_coercion_expression(), CacheInvalidateRelcacheByRelid(), call_pltcl_start_proc(), CallStmtResultDesc(), check_amop_signature(), check_amproc_signature(), check_default_text_search_config(), check_enable_rls(), check_for_column_name_collision(), check_hash_func_signature(), check_object_ownership(), check_role(), check_session_authorization(), CheckFunctionValidatorAccess(), CheckIndexCompatible(), CheckMyDatabase(), CloneFkReferenced(), CloneFkReferencing(), coerce_type(), CollationIsVisible(), compatible_oper(), compatible_oper_opid(), compile_plperl_function(), compile_pltcl_function(), compute_return_type(), ComputeIndexAttrs(), ComputePartitionAttrs(), ConstraintSetParentConstraint(), ConstructTupleDescriptor(), ConversionIsVisible(), convert_column_name(), CreateCast(), CreateFunction(), CreateProceduralLanguage(), CreateRole(), CreateSchemaCommand(), CreateStatistics(), CreateTransform(), DefineCollation(), DefineDomain(), DefineIndex(), DefineOpClass(), DefineTSConfiguration(), DefineType(), DeleteRelationTuple(), DeleteSequenceTuple(), deparseOpExpr(), deparseScalarArrayOpExpr(), DetachPartitionFinalize(), do_autovacuum(), do_compile(), do_setval(), dropdb(), DropObjectById(), DropRole(), DropSubscription(), enum_cmp_internal(), enum_in(), enum_out(), enum_recv(), enum_send(), errdatatype(), eval_const_expressions_mutator(), examine_simple_variable(), examine_variable(), ExecGrant_Attribute(), ExecGrant_common(), ExecGrant_Parameter(), ExecGrant_Relation(), ExecHashBuildSkewHash(), ExecInitAgg(), ExecuteCallStmt(), ExecuteDoStmt(), expand_all_col_privileges(), expand_vacuum_rel(), fetch_agg_sort_op(), fetch_fp_info(), fillTypeDesc(), find_coercion_pathway(), find_typmod_coercion_function(), fixup_whole_row_references(), flatten_reloptions(), fmgr_c_validator(), fmgr_info_cxt_security(), fmgr_info_other_lang(), fmgr_internal_validator(), fmgr_security_definer(), fmgr_sql_validator(), fmgr_symbol(), format_operator_extended(), format_operator_parts(), format_procedure_extended(), format_procedure_parts(), format_type_extended(), func_get_detail(), func_parallel(), func_strict(), func_volatile(), FuncNameAsType(), FunctionIsVisible(), generate_collation_name(), generate_function_name(), generate_operator_clause(), generate_operator_name(), generate_partition_qual(), generate_qualified_relation_name(), generate_qualified_type_name(), generate_relation_name(), generateClonedExtStatsStmt(), generateClonedIndexStmt(), get_am_name(), get_am_type_oid(), get_array_type(), get_attavgwidth(), get_attgenerated(), get_attname(), get_attnum(), get_attoptions(), get_attribute_options(), get_attstatsslot(), get_attstattarget(), get_atttype(), get_atttypetypmodcoll(), get_base_element_type(), get_collation(), get_collation_isdeterministic(), get_collation_name(), get_commutator(), get_constraint_index(), get_constraint_name(), get_database_name(), get_db_info(), get_default_acl_internal(), get_default_partition_oid(), get_element_type(), get_func_leakproof(), get_func_name(), get_func_namespace(), get_func_nargs(), get_func_prokind(), get_func_result_name(), get_func_retset(), get_func_rettype(), get_func_signature(), get_func_support(), get_func_variadictype(), get_function_rows(), get_index_column_opclass(), get_index_isclustered(), get_index_isreplident(), get_index_isvalid(), get_language_name(), get_multirange_range(), get_namespace_name(), get_negator(), get_object_address_defacl(), get_object_address_opf_member(), get_object_address_type(), get_object_address_usermapping(), get_object_namespace(), get_op_opfamily_properties(), get_op_opfamily_sortfamily(), get_op_opfamily_strategy(), get_op_rettype(), get_opclass(), get_opclass_family(), get_opclass_input_type(), get_opclass_name(), get_opclass_oid(), get_opclass_opfamily_and_input_type(), get_opcode(), get_opfamily_member(), get_opfamily_oid(), get_opfamily_proc(), get_opname(), get_oprjoin(), get_oprrest(), get_publication_name(), get_qual_for_range(), get_range_collation(), get_range_multirange(), get_range_subtype(), get_rel_name(), get_rel_namespace(), get_rel_persistence(), get_rel_relispartition(), get_rel_relkind(), get_rel_tablespace(), get_rel_type_id(), get_relation_statistics(), get_relation_statistics_worker(), get_rewrite_oid(), get_ri_constraint_root(), get_role_password(), get_rolespec_name(), get_rte_attribute_is_dropped(), get_subscription_name(), get_tablespace(), get_transform_fromsql(), get_transform_tosql(), get_typ_typrelid(), get_typbyval(), get_typcollation(), get_typdefault(), get_type_category_preferred(), get_type_io_data(), get_typisdefined(), get_typlen(), get_typlenbyval(), get_typlenbyvalalign(), get_typmodin(), get_typstorage(), get_typsubscript(), get_typtype(), getBaseTypeAndTypmod(), GetFdwRoutineByServerId(), GetForeignColumnOptions(), GetForeignDataWrapperExtended(), GetForeignServerExtended(), GetForeignServerIdByRelId(), GetForeignTable(), GetIndexAmRoutineByAmId(), getObjectDescription(), getObjectIdentityParts(), getOpFamilyDescription(), getOpFamilyIdentity(), getProcedureTypeDescription(), GetPublication(), getPublicationSchemaInfo(), getRelationDescription(), getRelationIdentity(), getRelationTypeDescription(), GetSubscription(), GetSubscriptionRelState(), GetSysCacheOid(), getTypeBinaryInputInfo(), getTypeBinaryOutputInfo(), getTypeInputInfo(), getTypeOutputInfo(), GetUserMapping(), GetUserNameFromId(), ginvalidate(), gistvalidate(), has_bypassrls_privilege(), has_createrole_privilege(), has_rolreplication(), has_subclass(), hash_ok_operator(), hashvalidate(), have_createdb_privilege(), heap_drop_with_catalog(), inclusion_get_strategy_procinfo(), index_check_primary_key(), index_concurrently_create_copy(), index_create(), index_drop(), index_get_partition(), indexam_property(), IndexGetRelation(), IndexSupportsBackwardScan(), init_sql_fcache(), initialize_peragg(), InitializeSessionUserId(), inline_set_returning_function(), InsertRule(), internal_get_result_type(), interpret_function_parameter_list(), IsBinaryCoercibleWithCast(), load_domaintype_info(), load_rangetype_info(), logicalrep_write_tuple(), logicalrep_write_typ(), lookup_collation(), lookup_collation_cache(), lookup_ts_config_cache(), lookup_ts_dictionary_cache(), lookup_ts_parser_cache(), lookup_type_cache(), LookupTypeNameOid(), make_callstmt_target(), make_inh_translation_list(), make_new_heap(), make_op(), make_scalar_array_op(), map_sql_table_to_xmlschema(), map_sql_type_to_xml_name(), minmax_get_strategy_procinfo(), minmax_multi_get_strategy_procinfo(), nextval_internal(), object_aclmask(), object_ownercheck(), op_hashjoinable(), op_input_types(), op_mergejoinable(), OpclassIsVisible(), OperatorGet(), OperatorIsVisible(), OpernameGetOprid(), OpfamilyIsVisible(), ParseFuncOrColumn(), parseTypeString(), pg_attribute_aclcheck_all(), pg_attribute_aclmask_ext(), pg_class_aclmask_ext(), pg_collation_actual_version(), pg_database_collation_actual_version(), pg_get_constraintdef_worker(), pg_get_function_arg_default(), pg_get_function_arguments(), pg_get_function_identity_arguments(), pg_get_function_result(), pg_get_function_sqlbody(), pg_get_functiondef(), pg_get_indexdef_worker(), pg_get_partkeydef_worker(), pg_get_statisticsobj_worker(), pg_get_statisticsobjdef_expressions(), pg_get_userbyid(), pg_namespace_aclmask(), pg_newlocale_from_collation(), pg_nextoid(), pg_parameter_acl_aclmask(), pg_parameter_aclmask(), pg_relation_filenode(), pg_relation_filepath(), pg_relation_is_publishable(), pg_sequence_parameters(), pg_type_aclmask(), pgoutput_column_list_init(), pgoutput_row_filter_init(), plperl_validator(), plpgsql_build_datatype(), plpgsql_compile(), plpgsql_parse_cwordtype(), plpgsql_parse_wordtype(), plpgsql_validator(), plpython3_validator(), plsample_func_handler(), plsample_trigger_handler(), PLy_procedure_create(), PLy_procedure_get(), prepare_column_cache(), preprocess_aggref(), print_function_arguments(), ProcedureCreate(), pub_collist_contains_invalid_column(), pub_rf_contains_invalid_column(), RangeVarCallbackForAlterRelation(), RangeVarCallbackForAttachIndex(), RangeVarCallbackForDropRelation(), RangeVarCallbackForPolicy(), RangeVarCallbackForRenameAttribute(), RangeVarCallbackForRenameRule(), RangeVarCallbackForRenameTrigger(), RangeVarCallbackForTruncate(), RangeVarCallbackOwnsRelation(), recomputeNamespacePath(), recordExtObjInitPriv(), refresh_by_match_merge(), regclassout(), regcollationout(), regconfigout(), regdictionaryout(), regoperout(), regprocout(), regtypeout(), RelationBuildPartitionDesc(), RelationBuildPartitionKey(), RelationBuildPublicationDesc(), RelationCacheInitializePhase3(), RelationClearMissing(), relationHasPrimaryKey(), RelationInitIndexAccessInfo(), RelationInitTableAccessMethod(), RelationIsVisible(), RelationReloadIndexInfo(), RemoveConstraintById(), removeExtObjInitPriv(), RemoveFunctionById(), RemoveOperatorById(), RemovePartitionKeyByRelId(), RemovePublicationById(), RemovePublicationRelById(), RemovePublicationSchemaById(), RemoveRoleFromObjectPolicy(), RemoveStatisticsById(), RemoveStatisticsDataById(), RemoveTSConfigurationById(), RemoveTypeById(), rename_constraint_internal(), RenameConstraint(), RenameRole(), replorigin_by_name(), replorigin_by_oid(), replorigin_drop_by_name(), ResetSequence(), ResolveOpClass(), ri_GenerateQualCollation(), ri_LoadConstraintInfo(), roles_is_member_of(), SearchSysCacheAttName(), SearchSysCacheAttNum(), SearchSysCacheCopy(), SearchSysCacheCopyAttName(), SearchSysCacheCopyAttNum(), SearchSysCacheExists(), SearchSysCacheExistsAttName(), sepgsql_proc_setattr(), sepgsql_relation_setattr(), sequence_options(), SetAttrMissing(), SetDefaultACL(), simplify_function(), spgvalidate(), SPI_gettype(), statext_dependencies_load(), statext_expressions_load(), statext_mcv_load(), statext_ndistinct_load(), StatisticsGetRelation(), StatisticsObjIsVisible(), superuser_arg(), transformCallStmt(), transformColumnDefinition(), transformColumnNameList(), transformColumnType(), transformFkeyCheckAttrs(), transformFkeyGetPrimaryKey(), transformOfType(), triggered_change_notification(), tryAttachPartitionForeignKey(), TryReuseForeignKey(), TSConfigIsVisible(), TSDictionaryIsVisible(), TSParserIsVisible(), TSTemplateIsVisible(), TupleDescInitEntry(), typeidTypeRelid(), typeIsOfTypedTable(), TypeIsVisible(), typenameTypeId(), typenameTypeIdAndMod(), typeOrDomainTypeRelid(), update_attstats(), validatePartitionedIndex(), and verify_dictoptions().

◆ SearchSysCache()

HeapTuple SearchSysCache ( int  cacheId,
Datum  key1,
Datum  key2,
Datum  key3,
Datum  key4 
)

Definition at line 805 of file syscache.c.

810 {
811  Assert(cacheId >= 0 && cacheId < SysCacheSize &&
812  PointerIsValid(SysCache[cacheId]));
813 
814  return SearchCatCache(SysCache[cacheId], key1, key2, key3, key4);
815 }
HeapTuple SearchCatCache(CatCache *cache, Datum v1, Datum v2, Datum v3, Datum v4)
Definition: catcache.c:1142

References Assert(), PointerIsValid, SearchCatCache(), SysCache, and SysCacheSize.

Referenced by GetSysCacheOid(), SearchSysCacheCopy(), and SearchSysCacheExists().

◆ SearchSysCache1()

HeapTuple SearchSysCache1 ( int  cacheId,
Datum  key1 
)

Definition at line 818 of file syscache.c.

820 {
821  Assert(cacheId >= 0 && cacheId < SysCacheSize &&
822  PointerIsValid(SysCache[cacheId]));
823  Assert(SysCache[cacheId]->cc_nkeys == 1);
824 
825  return SearchCatCache1(SysCache[cacheId], key1);
826 }
HeapTuple SearchCatCache1(CatCache *cache, Datum v1)
Definition: catcache.c:1159

References Assert(), PointerIsValid, SearchCatCache1(), SysCache, and SysCacheSize.

Referenced by aclitemout(), add_cast_to(), add_function_cost(), AddRoleMems(), agg_args_support_sendreceive(), AggregateCreate(), AlterDomainValidateConstraint(), AlterEnum(), AlterObjectRename_internal(), AlterOpFamily(), AlterSchemaOwner(), AlterSchemaOwner_oid(), AlterStatistics(), AlterTSDictionary(), AlterTypeOwner_oid(), AlterTypeRecurse(), amvalidate(), appendFunctionName(), appendOrderBySuffix(), assignOperTypes(), assignProcTypes(), ATAddForeignKeyConstraint(), ATDetachCheckNoForeignKeyRefs(), ATExecAlterColumnGenericOptions(), ATExecAlterConstraint(), ATExecChangeOwner(), ATExecDropNotNull(), ATExecSetRelOptions(), ATPostAlterTypeCleanup(), blvalidate(), brinvalidate(), btvalidate(), build_coercion_expression(), CacheInvalidateRelcacheByRelid(), call_pltcl_start_proc(), CallStmtResultDesc(), check_amop_signature(), check_amproc_signature(), check_default_text_search_config(), check_enable_rls(), check_hash_func_signature(), check_object_ownership(), check_role(), check_session_authorization(), CheckFunctionValidatorAccess(), CheckIndexCompatible(), CheckMyDatabase(), CloneFkReferenced(), CloneFkReferencing(), CollationIsVisible(), compile_plperl_function(), compile_pltcl_function(), ComputeIndexAttrs(), ConstraintSetParentConstraint(), ConstructTupleDescriptor(), ConversionIsVisible(), CreateCast(), CreateEventTrigger(), CreateFunction(), CreateProceduralLanguage(), CreateSchemaCommand(), CreateTransform(), DefineCollation(), DefineIndex(), DefineOpClass(), DefineTSConfiguration(), DeleteRelationTuple(), DeleteSequenceTuple(), deparseOpExpr(), deparseScalarArrayOpExpr(), DetachPartitionFinalize(), do_autovacuum(), do_compile(), do_setval(), dropdb(), DropObjectById(), DropRole(), enum_cmp_internal(), enum_out(), enum_send(), errdatatype(), eval_const_expressions_mutator(), ExecGrant_common(), ExecGrant_Parameter(), ExecGrant_Relation(), ExecInitAgg(), ExecuteCallStmt(), ExecuteDoStmt(), expand_vacuum_rel(), fetch_agg_sort_op(), fetch_fp_info(), fillTypeDesc(), fixup_whole_row_references(), flatten_reloptions(), fmgr_c_validator(), fmgr_info_cxt_security(), fmgr_info_other_lang(), fmgr_internal_validator(), fmgr_security_definer(), fmgr_sql_validator(), fmgr_symbol(), format_operator_extended(), format_operator_parts(), format_procedure_extended(), format_procedure_parts(), format_type_extended(), func_get_detail(), func_parallel(), func_strict(), func_volatile(), FunctionIsVisible(), generate_collation_name(), generate_function_name(), generate_operator_clause(), generate_operator_name(), generate_partition_qual(), generate_qualified_relation_name(), generate_qualified_type_name(), generate_relation_name(), generateClonedExtStatsStmt(), generateClonedIndexStmt(), get_am_name(), get_am_type_oid(), get_array_type(), get_attstatsslot(), get_base_element_type(), get_collation(), get_collation_isdeterministic(), get_collation_name(), get_commutator(), get_constraint_index(), get_constraint_name(), get_database_name(), get_db_info(), get_default_partition_oid(), get_element_type(), get_func_leakproof(), get_func_name(), get_func_namespace(), get_func_nargs(), get_func_prokind(), get_func_result_name(), get_func_retset(), get_func_rettype(), get_func_signature(), get_func_support(), get_func_variadictype(), get_function_rows(), get_index_column_opclass(), get_index_isclustered(), get_index_isreplident(), get_index_isvalid(), get_language_name(), get_multirange_range(), get_namespace_name(), get_negator(), get_object_address_defacl(), get_object_address_usermapping(), get_object_namespace(), get_op_rettype(), get_opclass(), get_opclass_family(), get_opclass_input_type(), get_opclass_name(), get_opclass_opfamily_and_input_type(), get_opcode(), get_opname(), get_oprjoin(), get_oprrest(), get_publication_name(), get_qual_for_range(), get_range_collation(), get_range_multirange(), get_range_subtype(), get_rel_name(), get_rel_namespace(), get_rel_persistence(), get_rel_relispartition(), get_rel_relkind(), get_rel_tablespace(), get_rel_type_id(), get_relation_statistics(), get_ri_constraint_root(), get_role_password(), get_rolespec_tuple(), get_subscription_name(), get_tablespace(), get_typ_typrelid(), get_typbyval(), get_typcollation(), get_typdefault(), get_type_category_preferred(), get_type_io_data(), get_typisdefined(), get_typlen(), get_typlenbyval(), get_typlenbyvalalign(), get_typmodin(), get_typstorage(), get_typsubscript(), get_typtype(), getBaseTypeAndTypmod(), GetFdwRoutineByServerId(), GetForeignDataWrapperExtended(), GetForeignServerExtended(), GetForeignServerIdByRelId(), GetForeignTable(), GetIndexAmRoutineByAmId(), getObjectDescription(), getObjectIdentityParts(), getOpFamilyDescription(), getOpFamilyIdentity(), getProcedureTypeDescription(), GetPublication(), getPublicationSchemaInfo(), getRelationDescription(), getRelationIdentity(), getRelationTypeDescription(), GetSubscription(), GetTSConfigTuple(), getTypeBinaryInputInfo(), getTypeBinaryOutputInfo(), getTypeInputInfo(), getTypeOutputInfo(), GetUserNameFromId(), ginvalidate(), gistvalidate(), has_bypassrls_privilege(), has_createrole_privilege(), has_rolreplication(), has_subclass(), hash_ok_operator(), hashvalidate(), have_createdb_privilege(), heap_drop_with_catalog(), index_concurrently_create_copy(), index_create(), index_drop(), index_get_partition(), indexam_property(), IndexGetRelation(), IndexSupportsBackwardScan(), init_sql_fcache(), initialize_peragg(), InitializeSessionUserId(), inline_set_returning_function(), internal_get_result_type(), left_oper(), load_domaintype_info(), load_rangetype_info(), logicalrep_write_tuple(), logicalrep_write_typ(), lookup_collation_cache(), lookup_ts_config_cache(), lookup_ts_dictionary_cache(), lookup_ts_parser_cache(), lookup_type_cache(), LookupTypeNameExtended(), make_callstmt_target(), make_new_heap(), map_sql_table_to_xmlschema(), map_sql_type_to_xml_name(), nextval_internal(), object_aclmask(), object_ownercheck(), op_hashjoinable(), op_input_types(), op_mergejoinable(), OpClassCacheLookup(), OpclassIsVisible(), oper(), OperatorIsVisible(), OpFamilyCacheLookup(), OpfamilyIsVisible(), ParseFuncOrColumn(), pg_attribute_aclcheck_all(), pg_attribute_aclmask_ext(), pg_class_aclmask_ext(), pg_collation_actual_version(), pg_database_collation_actual_version(), pg_get_constraintdef_worker(), pg_get_function_arg_default(), pg_get_function_arguments(), pg_get_function_identity_arguments(), pg_get_function_result(), pg_get_function_sqlbody(), pg_get_functiondef(), pg_get_indexdef_worker(), pg_get_partkeydef_worker(), pg_get_statisticsobj_worker(), pg_get_statisticsobjdef_expressions(), pg_get_userbyid(), pg_namespace_aclmask(), pg_newlocale_from_collation(), pg_parameter_acl_aclmask(), pg_parameter_aclmask(), pg_relation_filenode(), pg_relation_filepath(), pg_relation_is_publishable(), pg_sequence_parameters(), pg_type_aclmask(), plperl_validator(), plpgsql_build_datatype(), plpgsql_compile(), plpgsql_parse_cwordtype(), plpgsql_validator(), plpython3_validator(), plsample_func_handler(), plsample_trigger_handler(), PLy_procedure_create(), PLy_procedure_get(), prepare_column_cache(), preprocess_aggref(), print_function_arguments(), RangeVarCallbackForAlterRelation(), RangeVarCallbackForAttachIndex(), RangeVarCallbackForDropRelation(), RangeVarCallbackForPolicy(), RangeVarCallbackForRenameAttribute(), RangeVarCallbackForRenameRule(), RangeVarCallbackForRenameTrigger(), RangeVarCallbackForTruncate(), RangeVarCallbackOwnsRelation(), recomputeNamespacePath(), recordExtObjInitPriv(), refresh_by_match_merge(), regclassout(), regcollationout(), regconfigout(), regdictionaryout(), regoperout(), regprocout(), regtypeout(), RelationBuildPartitionDesc(), RelationBuildPartitionKey(), RelationBuildPublicationDesc(), RelationCacheInitializePhase3(), relationHasPrimaryKey(), RelationInitIndexAccessInfo(), RelationInitTableAccessMethod(), RelationIsVisible(), RelationReloadIndexInfo(), RemoveConstraintById(), removeExtObjInitPriv(), RemoveFunctionById(), RemoveOperatorById(), RemovePartitionKeyByRelId(), RemovePublicationById(), RemovePublicationRelById(), RemovePublicationSchemaById(), RemoveRoleFromObjectPolicy(), RemoveStatisticsById(), RemoveTSConfigurationById(), RemoveTypeById(), rename_constraint_internal(), RenameConstraint(), RenameRole(), replorigin_by_name(), replorigin_by_oid(), replorigin_drop_by_name(), ResetSequence(), ResolveOpClass(), ri_GenerateQualCollation(), ri_LoadConstraintInfo(), roles_is_member_of(), sepgsql_proc_setattr(), sepgsql_relation_setattr(), sequence_options(), simplify_function(), spgvalidate(), SPI_gettype(), StatisticsGetRelation(), StatisticsObjIsVisible(), superuser_arg(), transformCallStmt(), transformFkeyCheckAttrs(), transformFkeyGetPrimaryKey(), triggered_change_notification(), tryAttachPartitionForeignKey(), TryReuseForeignKey(), TSConfigIsVisible(), TSDictionaryIsVisible(), TSParserIsVisible(), TSTemplateIsVisible(), TupleDescInitEntry(), typeidType(), typeidTypeRelid(), typeIsOfTypedTable(), TypeIsVisible(), typeOrDomainTypeRelid(), validatePartitionedIndex(), and verify_dictoptions().

◆ SearchSysCache2()

HeapTuple SearchSysCache2 ( int  cacheId,
Datum  key1,
Datum  key2 
)

Definition at line 829 of file syscache.c.

831 {
832  Assert(cacheId >= 0 && cacheId < SysCacheSize &&
833  PointerIsValid(SysCache[cacheId]));
834  Assert(SysCache[cacheId]->cc_nkeys == 2);
835 
836  return SearchCatCache2(SysCache[cacheId], key1, key2);
837 }
HeapTuple SearchCatCache2(CatCache *cache, Datum v1, Datum v2)
Definition: catcache.c:1167

References Assert(), PointerIsValid, SearchCatCache2(), SysCache, and SysCacheSize.

Referenced by AddEnumLabel(), AlterPublicationOptions(), AlterPublicationSchemas(), AlterPublicationTables(), CastCreate(), check_for_column_name_collision(), convert_column_name(), CreateTransform(), DropSubscription(), enum_in(), enum_recv(), ExecGrant_Attribute(), expand_all_col_privileges(), find_coercion_pathway(), find_typmod_coercion_function(), fixup_whole_row_references(), get_attgenerated(), get_attname(), get_attoptions(), get_attribute_options(), get_attstattarget(), get_atttype(), get_atttypetypmodcoll(), get_object_address_usermapping(), get_relation_statistics_worker(), get_rewrite_oid(), get_rte_attribute_is_dropped(), get_transform_fromsql(), get_transform_tosql(), GetForeignColumnOptions(), GetSubscriptionRelState(), GetUserMapping(), index_check_primary_key(), InsertRule(), IsBinaryCoercibleWithCast(), pg_attribute_aclcheck_all(), pg_attribute_aclmask_ext(), pgoutput_column_list_init(), pgoutput_row_filter_init(), pub_collist_contains_invalid_column(), pub_rf_contains_invalid_column(), recordExtObjInitPriv(), RelationClearMissing(), removeExtObjInitPriv(), RemoveStatisticsDataById(), SearchSysCacheAttName(), SearchSysCacheAttNum(), statext_dependencies_load(), statext_expressions_load(), statext_mcv_load(), and statext_ndistinct_load().

◆ SearchSysCache3()

HeapTuple SearchSysCache3 ( int  cacheId,
Datum  key1,
Datum  key2,
Datum  key3 
)

◆ SearchSysCache4()

HeapTuple SearchSysCache4 ( int  cacheId,
Datum  key1,
Datum  key2,
Datum  key3,
Datum  key4 
)

Definition at line 851 of file syscache.c.

853 {
854  Assert(cacheId >= 0 && cacheId < SysCacheSize &&
855  PointerIsValid(SysCache[cacheId]));
856  Assert(SysCache[cacheId]->cc_nkeys == 4);
857 
858  return SearchCatCache4(SysCache[cacheId], key1, key2, key3, key4);
859 }
HeapTuple SearchCatCache4(CatCache *cache, Datum v1, Datum v2, Datum v3, Datum v4)
Definition: catcache.c:1183

References Assert(), PointerIsValid, SearchCatCache4(), SysCache, and SysCacheSize.

Referenced by get_object_address_opf_member(), get_opfamily_member(), get_opfamily_proc(), inclusion_get_strategy_procinfo(), minmax_get_strategy_procinfo(), minmax_multi_get_strategy_procinfo(), OperatorGet(), and OpernameGetOprid().

◆ SearchSysCacheAttName()

HeapTuple SearchSysCacheAttName ( Oid  relid,
const char *  attname 
)

Definition at line 959 of file syscache.c.

960 {
961  HeapTuple tuple;
962 
963  tuple = SearchSysCache2(ATTNAME,
964  ObjectIdGetDatum(relid),
966  if (!HeapTupleIsValid(tuple))
967  return NULL;
968  if (((Form_pg_attribute) GETSTRUCT(tuple))->attisdropped)
969  {
970  ReleaseSysCache(tuple);
971  return NULL;
972  }
973  return tuple;
974 }
#define GETSTRUCT(TUP)
Definition: htup_details.h:653
NameData attname
Definition: pg_attribute.h:41
FormData_pg_attribute * Form_pg_attribute
Definition: pg_attribute.h:209
static Datum ObjectIdGetDatum(Oid X)
Definition: postgres.h:252
static Datum CStringGetDatum(const char *X)
Definition: postgres.h:350
HeapTuple SearchSysCache2(int cacheId, Datum key1, Datum key2)
Definition: syscache.c:829

References attname, ATTNAME, CStringGetDatum(), GETSTRUCT, HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache2().

Referenced by ATExecAlterColumnGenericOptions(), ATExecCheckNotNull(), ATExecDropColumn(), ATExecSetOptions(), ATPrepAlterColumnType(), ATPrepSetNotNull(), ComputeIndexAttrs(), ComputePartitionAttrs(), CreateStatistics(), get_attnum(), make_inh_translation_list(), pg_nextoid(), plpgsql_parse_cwordtype(), SearchSysCacheCopyAttName(), SearchSysCacheExistsAttName(), SetAttrMissing(), and transformColumnNameList().

◆ SearchSysCacheAttNum()

HeapTuple SearchSysCacheAttNum ( Oid  relid,
int16  attnum 
)

Definition at line 1022 of file syscache.c.

1023 {
1024  HeapTuple tuple;
1025 
1026  tuple = SearchSysCache2(ATTNUM,
1027  ObjectIdGetDatum(relid),
1029  if (!HeapTupleIsValid(tuple))
1030  return NULL;
1031  if (((Form_pg_attribute) GETSTRUCT(tuple))->attisdropped)
1032  {
1033  ReleaseSysCache(tuple);
1034  return NULL;
1035  }
1036  return tuple;
1037 }
int16 attnum
Definition: pg_attribute.h:74
static Datum Int16GetDatum(int16 X)
Definition: postgres.h:172

References attnum, ATTNUM, GETSTRUCT, HeapTupleIsValid, Int16GetDatum(), ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache2().

Referenced by SearchSysCacheCopyAttNum().

◆ SearchSysCacheCopy()

HeapTuple SearchSysCacheCopy ( int  cacheId,
Datum  key1,
Datum  key2,
Datum  key3,
Datum  key4 
)

Definition at line 880 of file syscache.c.

885 {
886  HeapTuple tuple,
887  newtuple;
888 
889  tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
890  if (!HeapTupleIsValid(tuple))
891  return tuple;
892  newtuple = heap_copytuple(tuple);
893  ReleaseSysCache(tuple);
894  return newtuple;
895 }
HeapTuple heap_copytuple(HeapTuple tuple)
Definition: heaptuple.c:680

References heap_copytuple(), HeapTupleIsValid, ReleaseSysCache(), and SearchSysCache().

◆ SearchSysCacheCopyAttName()

HeapTuple SearchSysCacheCopyAttName ( Oid  relid,
const char *  attname 
)

Definition at line 982 of file syscache.c.

983 {
984  HeapTuple tuple,
985  newtuple;
986 
987  tuple = SearchSysCacheAttName(relid, attname);
988  if (!HeapTupleIsValid(tuple))
989  return tuple;
990  newtuple = heap_copytuple(tuple);
991  ReleaseSysCache(tuple);
992  return newtuple;
993 }
HeapTuple SearchSysCacheAttName(Oid relid, const char *attname)
Definition: syscache.c:959

References attname, heap_copytuple(), HeapTupleIsValid, ReleaseSysCache(), and SearchSysCacheAttName().

Referenced by ATExecAddColumn(), ATExecAddIdentity(), ATExecAlterColumnType(), ATExecDropColumn(), ATExecDropExpression(), ATExecDropIdentity(), ATExecDropNotNull(), ATExecSetCompression(), ATExecSetIdentity(), ATExecSetNotNull(), ATExecSetStatistics(), ATExecSetStorage(), ATPrepDropExpression(), MergeAttributesIntoExisting(), and renameatt_internal().

◆ SearchSysCacheCopyAttNum()

HeapTuple SearchSysCacheCopyAttNum ( Oid  relid,
int16  attnum 
)

Definition at line 1045 of file syscache.c.

1046 {
1047  HeapTuple tuple,
1048  newtuple;
1049 
1050  tuple = SearchSysCacheAttNum(relid, attnum);
1051  if (!HeapTupleIsValid(tuple))
1052  return NULL;
1053  newtuple = heap_copytuple(tuple);
1054  ReleaseSysCache(tuple);
1055  return newtuple;
1056 }
HeapTuple SearchSysCacheAttNum(Oid relid, int16 attnum)
Definition: syscache.c:1022

References attnum, heap_copytuple(), HeapTupleIsValid, ReleaseSysCache(), and SearchSysCacheAttNum().

Referenced by ATExecSetStatistics(), and SetIndexStorageProperties().

◆ SearchSysCacheExists()

bool SearchSysCacheExists ( int  cacheId,
Datum  key1,
Datum  key2,
Datum  key3,
Datum  key4 
)

Definition at line 904 of file syscache.c.

909 {
910  HeapTuple tuple;
911 
912  tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
913  if (!HeapTupleIsValid(tuple))
914  return false;
915  ReleaseSysCache(tuple);
916  return true;
917 }

References HeapTupleIsValid, ReleaseSysCache(), and SearchSysCache().

◆ SearchSysCacheExistsAttName()

bool SearchSysCacheExistsAttName ( Oid  relid,
const char *  attname 
)

Definition at line 1001 of file syscache.c.

1002 {
1003  HeapTuple tuple;
1004 
1005  tuple = SearchSysCacheAttName(relid, attname);
1006  if (!HeapTupleIsValid(tuple))
1007  return false;
1008  ReleaseSysCache(tuple);
1009  return true;
1010 }

References attname, HeapTupleIsValid, ReleaseSysCache(), and SearchSysCacheAttName().

Referenced by RemoveInheritance().

◆ SearchSysCacheList()

struct catclist* SearchSysCacheList ( int  cacheId,
int  nkeys,
Datum  key1,
Datum  key2,
Datum  key3 
)

Definition at line 1157 of file syscache.c.

1159 {
1160  if (cacheId < 0 || cacheId >= SysCacheSize ||
1161  !PointerIsValid(SysCache[cacheId]))
1162  elog(ERROR, "invalid cache ID: %d", cacheId);
1163 
1164  return SearchCatCacheList(SysCache[cacheId], nkeys,
1165  key1, key2, key3);
1166 }
CatCList * SearchCatCacheList(CatCache *cache, int nkeys, Datum v1, Datum v2, Datum v3)
Definition: catcache.c:1501

References elog(), ERROR, catclist::nkeys, PointerIsValid, SearchCatCacheList(), SysCache, and SysCacheSize.

◆ SysCacheGetAttr()

Datum SysCacheGetAttr ( int  cacheId,
HeapTuple  tup,
AttrNumber  attributeNumber,
bool isNull 
)

Definition at line 1079 of file syscache.c.

1082 {
1083  /*
1084  * We just need to get the TupleDesc out of the cache entry, and then we
1085  * can apply heap_getattr(). Normally the cache control data is already
1086  * valid (because the caller recently fetched the tuple via this same
1087  * cache), but there are cases where we have to initialize the cache here.
1088  */
1089  if (cacheId < 0 || cacheId >= SysCacheSize ||
1090  !PointerIsValid(SysCache[cacheId]))
1091  elog(ERROR, "invalid cache ID: %d", cacheId);
1092  if (!PointerIsValid(SysCache[cacheId]->cc_tupdesc))
1093  {
1094  InitCatCachePhase2(SysCache[cacheId], false);
1095  Assert(PointerIsValid(SysCache[cacheId]->cc_tupdesc));
1096  }
1097 
1098  return heap_getattr(tup, attributeNumber,
1099  SysCache[cacheId]->cc_tupdesc,
1100  isNull);
1101 }

References Assert(), elog(), ERROR, heap_getattr(), InitCatCachePhase2(), PointerIsValid, SysCache, and SysCacheSize.

Referenced by AlterCollation(), AlterForeignDataWrapper(), AlterForeignServer(), AlterFunction(), AlterPublicationTables(), AlterRole(), AlterSchemaOwner_internal(), AlterTSDictionary(), AlterUserMapping(), ATExecAlterColumnGenericOptions(), ATExecChangeOwner(), ATExecGenericOptions(), ATExecSetOptions(), ATExecSetRelOptions(), build_function_result_tupdesc_t(), CheckMyDatabase(), compile_plperl_function(), DeconstructFkConstraintRow(), DefineCollation(), DefineDomain(), DropSubscription(), ExecGrant_Attribute(), ExecGrant_common(), ExecGrant_Parameter(), ExecGrant_Relation(), ExecInitAgg(), expand_function_arguments(), fetch_statentries_for_relation(), flatten_reloptions(), fmgr_security_definer(), fmgr_sql_validator(), FuncnameGetCandidates(), generate_partition_qual(), generateClonedExtStatsStmt(), generateClonedIndexStmt(), get_attoptions(), get_attribute_options(), get_db_info(), get_default_acl_internal(), get_func_arg_info(), get_func_trftypes(), get_relation_statistics(), get_role_password(), get_tablespace(), get_typdefault(), GetForeignColumnOptions(), GetForeignDataWrapperExtended(), GetForeignServerExtended(), GetForeignTable(), GetSubscription(), GetSubscriptionRelations(), GetSubscriptionRelState(), GetUserMapping(), index_concurrently_create_copy(), init_sql_fcache(), initialize_peragg(), inline_function(), inline_set_returning_function(), lookup_ts_dictionary_cache(), make_new_heap(), MatchNamedCall(), object_aclmask(), pg_attribute_aclmask_ext(), pg_class_aclmask_ext(), pg_get_constraintdef_worker(), pg_get_function_arg_default(), pg_get_function_sqlbody(), pg_get_functiondef(), pg_get_publication_tables(), pg_namespace_aclmask(), pg_newlocale_from_collation(), pg_parameter_acl_aclmask(), pg_parameter_aclmask(), pg_type_aclmask(), pgoutput_column_list_init(), pgoutput_row_filter_init(), plsample_func_handler(), plsample_trigger_handler(), PLy_procedure_create(), prepare_sql_fn_parse_info(), preprocess_aggref(), print_function_arguments(), ProcedureCreate(), pub_collist_contains_invalid_column(), pub_rf_contains_invalid_column(), recordExtObjInitPriv(), RelationBuildPartitionDesc(), RelationBuildPartitionKey(), SetDefaultACL(), statext_dependencies_load(), statext_expressions_load(), statext_mcv_load(), statext_ndistinct_load(), StorePartitionBound(), SysCacheGetAttrNotNull(), and transformCallStmt().

◆ SysCacheGetAttrNotNull()

Datum SysCacheGetAttrNotNull ( int  cacheId,
HeapTuple  tup,
AttrNumber  attributeNumber 
)

Definition at line 1110 of file syscache.c.

1112 {
1113  bool isnull;
1114  Datum attr;
1115 
1116  attr = SysCacheGetAttr(cacheId, tup, attributeNumber, &isnull);
1117 
1118  if (isnull)
1119  {
1120  elog(ERROR,
1121  "unexpected null value in cached tuple for catalog %s column %s",
1122  get_rel_name(cacheinfo[cacheId].reloid),
1123  NameStr(TupleDescAttr(SysCache[cacheId]->cc_tupdesc, attributeNumber - 1)->attname));
1124  }
1125 
1126  return attr;
1127 }
#define NameStr(name)
Definition: c.h:730
char * get_rel_name(Oid relid)
Definition: lsyscache.c:1910
uintptr_t Datum
Definition: postgres.h:64
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Definition: syscache.c:1079
#define TupleDescAttr(tupdesc, i)
Definition: tupdesc.h:92

References attname, cacheinfo, elog(), ERROR, get_rel_name(), NameStr, cachedesc::reloid, SysCache, SysCacheGetAttr(), and TupleDescAttr.

Referenced by AlterCollation(), AlterDomainValidateConstraint(), ATExecValidateConstraint(), build_function_result_tupdesc_t(), build_replindex_scan_key(), CheckIndexCompatible(), CheckMyDatabase(), compile_plperl_function(), compile_pltcl_function(), DeconstructFkConstraintRow(), do_compile(), DropSubscription(), ExecGrant_common(), ExecGrant_Parameter(), fetch_function_defaults(), fetch_statentries_for_relation(), fmgr_c_validator(), fmgr_info_C_lang(), fmgr_info_cxt_security(), fmgr_internal_validator(), fmgr_sql_validator(), fmgr_symbol(), func_get_detail(), generateClonedExtStatsStmt(), generateClonedIndexStmt(), get_attstatsslot(), get_db_info(), get_func_result_name(), get_index_column_opclass(), get_object_namespace(), get_qual_for_range(), getObjectDescription(), getObjectIdentityParts(), GetSubscription(), inclusion_get_strategy_procinfo(), index_concurrently_create_copy(), index_opclass_options(), init_sql_fcache(), inline_function(), inline_set_returning_function(), lookup_collation_cache(), minmax_get_strategy_procinfo(), minmax_multi_get_strategy_procinfo(), object_aclmask(), object_ownercheck(), pg_collation_actual_version(), pg_database_collation_actual_version(), pg_get_constraintdef_worker(), pg_get_functiondef(), pg_get_indexdef_worker(), pg_get_partkeydef_worker(), pg_get_statisticsobj_worker(), pg_get_statisticsobjdef_expressions(), pg_newlocale_from_collation(), PLy_procedure_create(), print_function_sqlbody(), ProcedureCreate(), refresh_by_match_merge(), RelationBuildPartitionKey(), test_indoption(), transformFkeyCheckAttrs(), transformFkeyGetPrimaryKey(), transformIndexConstraint(), and TryReuseForeignKey().

◆ SysCacheInvalidate()

void SysCacheInvalidate ( int  cacheId,
uint32  hashValue 
)

Definition at line 1177 of file syscache.c.

1178 {
1179  if (cacheId < 0 || cacheId >= SysCacheSize)
1180  elog(ERROR, "invalid cache ID: %d", cacheId);
1181 
1182  /* if this cache isn't initialized yet, no need to do anything */
1183  if (!PointerIsValid(SysCache[cacheId]))
1184  return;
1185 
1186  CatCacheInvalidate(SysCache[cacheId], hashValue);
1187 }
void CatCacheInvalidate(CatCache *cache, uint32 hashValue)
Definition: catcache.c:546

References CatCacheInvalidate(), elog(), ERROR, PointerIsValid, SysCache, and SysCacheSize.

Referenced by LocalExecuteInvalidationMessage().