* Append the relation identity (quoted qualified name) to the given * StringInfo. */
| 6451 | * StringInfo. |
| 6452 | */ |
| 6453 | static void |
| 6454 | getRelationIdentity(StringInfo buffer, Oid relid, List **object, |
| 6455 | bool missing_ok) |
| 6456 | { |
| 6457 | HeapTuple relTup; |
| 6458 | Form_pg_class relForm; |
| 6459 | char *schema; |
| 6460 | |
| 6461 | relTup = SearchSysCache1(RELOID, |
| 6462 | ObjectIdGetDatum(relid)); |
| 6463 | if (!HeapTupleIsValid(relTup)) |
| 6464 | { |
| 6465 | if (!missing_ok) |
| 6466 | elog(ERROR, "cache lookup failed for relation %u", relid); |
| 6467 | |
| 6468 | if (object) |
| 6469 | *object = NIL; |
| 6470 | return; |
| 6471 | } |
| 6472 | relForm = (Form_pg_class) GETSTRUCT(relTup); |
| 6473 | |
| 6474 | schema = get_namespace_name_or_temp(relForm->relnamespace); |
| 6475 | appendStringInfoString(buffer, |
| 6476 | quote_qualified_identifier(schema, |
| 6477 | NameStr(relForm->relname))); |
| 6478 | if (object) |
| 6479 | *object = list_make2(schema, pstrdup(NameStr(relForm->relname))); |
| 6480 | |
| 6481 | ReleaseSysCache(relTup); |
| 6482 | } |
| 6483 | |
| 6484 | /* |
| 6485 | * Auxiliary function to build a TEXT array out of a list of C-strings. |
no test coverage detected