* given attribute id, return type of that attribute * * This should only be used if the relation is already * table_open()'ed. Use the cache version get_atttype() * for access to non-opened relations. */
| 3804 | * for access to non-opened relations. |
| 3805 | */ |
| 3806 | Oid |
| 3807 | attnumTypeId(Relation rd, int attid) |
| 3808 | { |
| 3809 | if (attid <= 0) |
| 3810 | { |
| 3811 | const FormData_pg_attribute *sysatt; |
| 3812 | |
| 3813 | sysatt = SystemAttributeDefinition(attid); |
| 3814 | return sysatt->atttypid; |
| 3815 | } |
| 3816 | if (attid > rd->rd_att->natts) |
| 3817 | elog(ERROR, "invalid attribute number %d", attid); |
| 3818 | return TupleDescAttr(rd->rd_att, attid - 1)->atttypid; |
| 3819 | } |
| 3820 | |
| 3821 | /* |
| 3822 | * given attribute id, return collation of that attribute |
no test coverage detected