* 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. */
| 436 | * it is mostly used for reporting lookup errors. |
| 437 | */ |
| 438 | static void |
| 439 | appendTypeNameToBuffer(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 |
no test coverage detected