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

Function attnameAttNum

src/backend/parser/parse_relation.c:3734–3755  ·  view source on GitHub ↗

* given relation and att name, return attnum of variable * * Returns InvalidAttrNumber if the attr doesn't exist (or is dropped). * * This should only be used if the relation is already * table_open()'ed. Use the cache version get_attnum() * for access to non-opened relations. */

Source from the content-addressed store, hash-verified

3732 * for access to non-opened relations.
3733 */
3734int
3735attnameAttNum(Relation rd, const char *attname, bool sysColOK)
3736{
3737 int i;
3738
3739 for (i = 0; i < RelationGetNumberOfAttributes(rd); i++)
3740 {
3741 Form_pg_attribute att = TupleDescAttr(rd->rd_att, i);
3742
3743 if (namestrcmp(&(att->attname), attname) == 0 && !att->attisdropped)
3744 return i + 1;
3745 }
3746
3747 if (sysColOK)
3748 {
3749 if ((i = specialAttNum(attname)) != InvalidAttrNumber)
3750 return i;
3751 }
3752
3753 /* on failure */
3754 return InvalidAttrNumber;
3755}
3756
3757/* specialAttNum()
3758 *

Callers 4

do_analyze_relFunction · 0.85
CreateTriggerFiringOnFunction · 0.85
checkInsertTargetsFunction · 0.85

Calls 2

namestrcmpFunction · 0.85
specialAttNumFunction · 0.85

Tested by

no test coverage detected