---------------- * table_openrv - open a table relation specified * by a RangeVar node * * As above, but relation is specified by a RangeVar. * ---------------- */
| 104 | * ---------------- |
| 105 | */ |
| 106 | Relation |
| 107 | table_openrv(const RangeVar *relation, LOCKMODE lockmode) |
| 108 | { |
| 109 | Relation r; |
| 110 | |
| 111 | r = relation_openrv(relation, lockmode); |
| 112 | |
| 113 | if (r->rd_rel->relkind == RELKIND_INDEX || |
| 114 | r->rd_rel->relkind == RELKIND_PARTITIONED_INDEX) |
| 115 | ereport(ERROR, |
| 116 | (errcode(ERRCODE_WRONG_OBJECT_TYPE), |
| 117 | errmsg("\"%s\" is an index", |
| 118 | RelationGetRelationName(r)))); |
| 119 | else if (r->rd_rel->relkind == RELKIND_COMPOSITE_TYPE) |
| 120 | ereport(ERROR, |
| 121 | (errcode(ERRCODE_WRONG_OBJECT_TYPE), |
| 122 | errmsg("\"%s\" is a composite type", |
| 123 | RelationGetRelationName(r)))); |
| 124 | |
| 125 | return r; |
| 126 | } |
| 127 | |
| 128 | /* ---------------- |
| 129 | * table_openrv_extended - open a table relation specified |
no test coverage detected