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

Function defGetTypeName

src/backend/commands/define.c:254–276  ·  view source on GitHub ↗

* Extract a TypeName from a DefElem. * * Note: we do not accept a List arg here, because the parser will only * return a bare List when the name looks like an operator name. */

Source from the content-addressed store, hash-verified

252 * return a bare List when the name looks like an operator name.
253 */
254TypeName *
255defGetTypeName(DefElem *def)
256{
257 if (def->arg == NULL)
258 ereport(ERROR,
259 (errcode(ERRCODE_SYNTAX_ERROR),
260 errmsg("%s requires a parameter",
261 def->defname)));
262 switch (nodeTag(def->arg))
263 {
264 case T_TypeName:
265 return (TypeName *) def->arg;
266 case T_String:
267 /* Allow quoted typename for backwards compatibility */
268 return makeTypeNameFromNameList(list_make1(def->arg));
269 default:
270 ereport(ERROR,
271 (errcode(ERRCODE_SYNTAX_ERROR),
272 errmsg("argument of %s must be a type name",
273 def->defname)));
274 }
275 return NULL; /* keep compiler quiet */
276}
277
278/*
279 * Extract a type length indicator (either absolute bytes, or

Callers 5

DefineTypeFunction · 0.85
DefineRangeFunction · 0.85
DefineOperatorFunction · 0.85
init_paramsFunction · 0.85
DefineAggregateFunction · 0.85

Calls 3

makeTypeNameFromNameListFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected