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

Function get_attnum

src/backend/utils/cache/lsyscache.c:1005–1022  ·  view source on GitHub ↗

* get_attnum * * Given the relation id and the attribute name, * return the "attnum" field from the attribute relation. * * Returns InvalidAttrNumber if the attr doesn't exist (or is dropped). */

Source from the content-addressed store, hash-verified

1003 * Returns InvalidAttrNumber if the attr doesn't exist (or is dropped).
1004 */
1005AttrNumber
1006get_attnum(Oid relid, const char *attname)
1007{
1008 HeapTuple tp;
1009
1010 tp = SearchSysCacheAttName(relid, attname);
1011 if (HeapTupleIsValid(tp))
1012 {
1013 Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
1014 AttrNumber result;
1015
1016 result = att_tup->attnum;
1017 ReleaseSysCache(tp);
1018 return result;
1019 }
1020 else
1021 return InvalidAttrNumber;
1022}
1023
1024/*
1025 * get_attstattarget

Callers 12

fixup_inherited_columnsFunction · 0.85
pg_get_serial_sequenceFunction · 0.85
try_fetch_rel_statsFunction · 0.85
ATExecDropNotNullFunction · 0.85
ATExecColumnDefaultFunction · 0.85
process_owned_byFunction · 0.85
transformAlterTableStmtFunction · 0.85
LookupTypeNameExtendedFunction · 0.85
expand_col_privilegesFunction · 0.85

Calls 2

SearchSysCacheAttNameFunction · 0.85
ReleaseSysCacheFunction · 0.85

Tested by

no test coverage detected