* typenameType - given a TypeName, return a Type structure and typmod * * This is equivalent to LookupTypeName, except that this will report * a suitable error message if the type cannot be found or is not defined. * Callers of this can therefore assume the result is a fully valid type. */
| 263 | * Callers of this can therefore assume the result is a fully valid type. |
| 264 | */ |
| 265 | Type |
| 266 | typenameType(ParseState *pstate, const TypeName *typeName, int32 *typmod_p) |
| 267 | { |
| 268 | Type tup; |
| 269 | |
| 270 | tup = LookupTypeName(pstate, typeName, typmod_p, false); |
| 271 | if (tup == NULL) |
| 272 | ereport(ERROR, |
| 273 | (errcode(ERRCODE_UNDEFINED_OBJECT), |
| 274 | errmsg("type \"%s\" does not exist", |
| 275 | TypeNameToString(typeName)), |
| 276 | parser_errposition(pstate, typeName->location))); |
| 277 | if (!((Form_pg_type) GETSTRUCT(tup))->typisdefined) |
| 278 | ereport(ERROR, |
| 279 | (errcode(ERRCODE_UNDEFINED_OBJECT), |
| 280 | errmsg("type \"%s\" is only a shell", |
| 281 | TypeNameToString(typeName)), |
| 282 | parser_errposition(pstate, typeName->location))); |
| 283 | return tup; |
| 284 | } |
| 285 | |
| 286 | /* |
| 287 | * typenameTypeId - given a TypeName, return the type's OID |
no test coverage detected