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

Function getFunctionName

src/bin/pg_dump/pg_dump.c:15867–15902  ·  view source on GitHub ↗

* getFunctionName - retrieves a function name from an oid * */

Source from the content-addressed store, hash-verified

15865 *
15866 */
15867static char *
15868getFunctionName(Archive *fout, Oid oid)
15869{
15870 char *result;
15871 PQExpBuffer query;
15872 PGresult *res;
15873 int ntups;
15874
15875 if (oid == InvalidOid)
15876 {
15877 return NULL;
15878 }
15879
15880 query = createPQExpBuffer();
15881
15882 appendPQExpBuffer(query, "SELECT proname FROM pg_proc WHERE oid = %u;",oid);
15883
15884 res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
15885
15886 /* Expecting a single result only */
15887 ntups = PQntuples(res);
15888 if (ntups != 1)
15889 {
15890 pg_log_warning("query yielded %d rows instead of one: %s",
15891 ntups, query->data);
15892 exit_nicely(1);
15893 }
15894
15895 /* already quoted */
15896 result = pg_strdup(PQgetvalue(res, 0, 0));
15897
15898 PQclear(res);
15899 destroyPQExpBuffer(query);
15900
15901 return result;
15902}
15903
15904/*
15905 * dumpExtProtocol

Callers 1

dumpExtProtocolFunction · 0.85

Calls 9

createPQExpBufferFunction · 0.85
appendPQExpBufferFunction · 0.85
ExecuteSqlQueryFunction · 0.85
PQntuplesFunction · 0.85
pg_strdupFunction · 0.85
PQgetvalueFunction · 0.85
PQclearFunction · 0.85
destroyPQExpBufferFunction · 0.85
exit_nicelyFunction · 0.70

Tested by

no test coverage detected