* 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). */
| 1003 | * Returns InvalidAttrNumber if the attr doesn't exist (or is dropped). |
| 1004 | */ |
| 1005 | AttrNumber |
| 1006 | get_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 |
no test coverage detected