MCPcopy Create free account
hub / github.com/apache/cloudberry / SysCacheGetAttr

Function SysCacheGetAttr

src/backend/utils/cache/syscache.c:1616–1639  ·  view source on GitHub ↗

* SysCacheGetAttr * * Given a tuple previously fetched by SearchSysCache(), * extract a specific attribute. * * This is equivalent to using heap_getattr() on a tuple fetched * from a non-cached relation. Usually, this is only used for attributes * that could be NULL or variable length; the fixed-size attributes in * a system table are accessed just by mapping the tuple onto the C struct

Source from the content-addressed store, hash-verified

1614 * a different cache for the same catalog the tuple was fetched from.
1615 */
1616Datum
1617SysCacheGetAttr(int cacheId, HeapTuple tup,
1618 AttrNumber attributeNumber,
1619 bool *isNull)
1620{
1621 /*
1622 * We just need to get the TupleDesc out of the cache entry, and then we
1623 * can apply heap_getattr(). Normally the cache control data is already
1624 * valid (because the caller recently fetched the tuple via this same
1625 * cache), but there are cases where we have to initialize the cache here.
1626 */
1627 if (cacheId < 0 || cacheId >= SysCacheSize ||
1628 !PointerIsValid(SysCache[cacheId]))
1629 elog(ERROR, "invalid cache ID: %d", cacheId);
1630 if (!PointerIsValid(SysCache[cacheId]->cc_tupdesc))
1631 {
1632 InitCatCachePhase2(SysCache[cacheId], false);
1633 Assert(PointerIsValid(SysCache[cacheId]->cc_tupdesc));
1634 }
1635
1636 return heap_getattr(tup, attributeNumber,
1637 SysCache[cacheId]->cc_tupdesc,
1638 isNull);
1639}
1640
1641/*
1642 * GetSysCacheHashValue

Callers 15

PGGetAddOperatorFunction · 0.85
PGGetProcFunction · 0.85
PGGetAggInfoFunction · 0.85
SumAGGGetProcinfoFunction · 0.85
compile_pltcl_functionFunction · 0.85
do_compileFunction · 0.85
compile_plperl_functionFunction · 0.85
PLy_procedure_createFunction · 0.85
statext_ndistinct_loadFunction · 0.85
statext_mcv_loadFunction · 0.85
statext_expressions_loadFunction · 0.85

Calls 2

InitCatCachePhase2Function · 0.85
heap_getattrFunction · 0.85

Tested by 2

test_indoptionFunction · 0.68
plsample_func_handlerFunction · 0.68