2202{
2203 Oid atttypid = InvalidOid;
2204 Form_pg_attribute att_form;
2205
2206
2207 HeapTuple att_tuple = SearchSysCache2(ATTNUM,
2208 ObjectIdGetDatum(index_oid),
2209 Int16GetDatum(index_attnum));
2210
2211 if (!HeapTupleIsValid(att_tuple))
2212 elog(ERROR, "cache lookup failed for index %u attribute %d", index_oid, index_attnum);
2213
2214 att_form = (Form_pg_attribute) GETSTRUCT(att_tuple);
2215 atttypid = att_form->atttypid;
2216 ReleaseSysCache(att_tuple);
2217 return atttypid;
2218}