MCPcopy Create free account
hub / github.com/apache/cloudberry / LookupTypeNameOid

Function LookupTypeNameOid

src/backend/parser/parse_type.c:233–256  ·  view source on GitHub ↗

* LookupTypeNameOid * Given a TypeName object, lookup the pg_type syscache entry of the type. * Returns InvalidOid if no such type can be found. If the type is found, * return its Oid. * * NB: direct callers of this function need to be aware that the type OID * returned may correspond to a shell type. Most code should go through * typenameTypeId instead. * * pstate is only used for e

Source from the content-addressed store, hash-verified

231 * pstate is only used for error location info, and may be NULL.
232 */
233Oid
234LookupTypeNameOid(ParseState *pstate, const TypeName *typeName, bool missing_ok)
235{
236 Oid typoid;
237 Type tup;
238
239 tup = LookupTypeName(pstate, typeName, NULL, missing_ok);
240 if (tup == NULL)
241 {
242 if (!missing_ok)
243 ereport(ERROR,
244 (errcode(ERRCODE_UNDEFINED_OBJECT),
245 errmsg("type \"%s\" does not exist",
246 TypeNameToString(typeName)),
247 parser_errposition(pstate, typeName->location)));
248
249 return InvalidOid;
250 }
251
252 typoid = ((Form_pg_type) GETSTRUCT(tup))->oid;
253 ReleaseSysCache(tup);
254
255 return typoid;
256}
257
258/*
259 * typenameType - given a TypeName, return a Type structure and typmod

Callers 4

LookupOperWithArgsFunction · 0.85
LookupFuncWithArgsFunction · 0.85
get_object_addressFunction · 0.85

Calls 6

LookupTypeNameFunction · 0.85
TypeNameToStringFunction · 0.85
parser_errpositionFunction · 0.85
ReleaseSysCacheFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected