* NameListToString * Utility routine to convert a qualified-name list into a string. * * This is used primarily to form error messages, and so we do not quote * the list elements, for the sake of legibility. * * In most scenarios the list elements should always be Value strings, * but we also allow A_Star for the convenience of ColumnRef processing. */
| 3210 | * but we also allow A_Star for the convenience of ColumnRef processing. |
| 3211 | */ |
| 3212 | char * |
| 3213 | NameListToString(List *names) |
| 3214 | { |
| 3215 | StringInfoData string; |
| 3216 | ListCell *l; |
| 3217 | |
| 3218 | initStringInfo(&string); |
| 3219 | |
| 3220 | foreach(l, names) |
| 3221 | { |
| 3222 | Node *name = (Node *) lfirst(l); |
| 3223 | |
| 3224 | if (l != list_head(names)) |
| 3225 | appendStringInfoChar(&string, '.'); |
| 3226 | |
| 3227 | if (IsA(name, String)) |
| 3228 | appendStringInfoString(&string, strVal(name)); |
| 3229 | else if (IsA(name, A_Star)) |
| 3230 | appendStringInfoChar(&string, '*'); |
| 3231 | else |
| 3232 | elog(ERROR, "unexpected node type in name list: %d", |
| 3233 | (int) nodeTag(name)); |
| 3234 | } |
| 3235 | |
| 3236 | return string.data; |
| 3237 | } |
| 3238 | |
| 3239 | /* |
| 3240 | * NameListToQuotedString |
no test coverage detected