* given attribute id, return name 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. */
| 3782 | * for access to non-opened relations. |
| 3783 | */ |
| 3784 | const NameData * |
| 3785 | attnumAttName(Relation rd, int attid) |
| 3786 | { |
| 3787 | if (attid <= 0) |
| 3788 | { |
| 3789 | const FormData_pg_attribute *sysatt; |
| 3790 | |
| 3791 | sysatt = SystemAttributeDefinition(attid); |
| 3792 | return &sysatt->attname; |
| 3793 | } |
| 3794 | if (attid > rd->rd_att->natts) |
| 3795 | elog(ERROR, "invalid attribute number %d", attid); |
| 3796 | return &TupleDescAttr(rd->rd_att, attid - 1)->attname; |
| 3797 | } |
| 3798 | |
| 3799 | /* |
| 3800 | * given attribute id, return type of that attribute |
no test coverage detected