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

Function appendTypeNameToBuffer

src/backend/parser/parse_type.c:438–468  ·  view source on GitHub ↗

* appendTypeNameToBuffer * Append a string representing the name of a TypeName to a StringInfo. * This is the shared guts of TypeNameToString and TypeNameListToString. * * NB: this must work on TypeNames that do not describe any actual type; * it is mostly used for reporting lookup errors. */

Source from the content-addressed store, hash-verified

436 * it is mostly used for reporting lookup errors.
437 */
438static void
439appendTypeNameToBuffer(const TypeName *typeName, StringInfo string)
440{
441 if (typeName->names != NIL)
442 {
443 /* Emit possibly-qualified name as-is */
444 ListCell *l;
445
446 foreach(l, typeName->names)
447 {
448 if (l != list_head(typeName->names))
449 appendStringInfoChar(string, '.');
450 appendStringInfoString(string, strVal(lfirst(l)));
451 }
452 }
453 else
454 {
455 /* Look up internally-specified type */
456 appendStringInfoString(string, format_type_be(typeName->typeOid));
457 }
458
459 /*
460 * Add decoration as needed, but only for fields considered by
461 * LookupTypeName
462 */
463 if (typeName->pct_type)
464 appendStringInfoString(string, "%TYPE");
465
466 if (typeName->arrayBounds != NIL)
467 appendStringInfoString(string, "[]");
468}
469
470/*
471 * TypeNameToString

Callers 2

TypeNameToStringFunction · 0.85
TypeNameListToStringFunction · 0.85

Calls 5

list_headFunction · 0.85
appendStringInfoCharFunction · 0.85
appendStringInfoStringFunction · 0.85
format_type_beFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected