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

Function getExtProtocols

src/bin/pg_dump/pg_dump.c:6815–6959  ·  view source on GitHub ↗

* getExtProtocols: * read all the user-defined protocols in the system catalogs and * return them in the ExtProtInfo* structure * * numExtProtocols is set to the number of protocols read in */ Declared in pg_dump.h */

Source from the content-addressed store, hash-verified

6813 */
6814/* Declared in pg_dump.h */
6815ExtProtInfo *
6816getExtProtocols(Archive *fout, int *numExtProtocols)
6817{
6818 PGresult *res;
6819 int ntups;
6820 int i;
6821 PQExpBuffer query = createPQExpBuffer();
6822 ExtProtInfo *ptcinfo;
6823 int i_oid;
6824 int i_tableoid;
6825 int i_ptcname;
6826 int i_rolname;
6827 int i_ptcacl;
6828 int i_ptcracl;
6829 int i_ptcinitacl;
6830 int i_ptcinitracl;
6831 int i_ptctrusted;
6832 int i_ptcreadid;
6833 int i_ptcwriteid;
6834 int i_ptcvalidid;
6835
6836 /* find all user-defined external protocol */
6837
6838
6839 if (fout->remoteVersion >= 90600)
6840 {
6841 PQExpBuffer acl_subquery = createPQExpBuffer();
6842 PQExpBuffer racl_subquery = createPQExpBuffer();
6843 PQExpBuffer initacl_subquery = createPQExpBuffer();
6844 PQExpBuffer initracl_subquery = createPQExpBuffer();
6845
6846 buildACLQueries(acl_subquery, racl_subquery, initacl_subquery,
6847 initracl_subquery, "ptc.ptcacl", "ptc.ptcowner", "'E'",
6848 fout->dopt->binary_upgrade);
6849
6850 appendPQExpBuffer(query, "SELECT ptc.tableoid as tableoid, "
6851 " ptc.oid as oid, "
6852 " ptc.ptcname as ptcname, "
6853 " ptcreadfn as ptcreadoid, "
6854 " ptcwritefn as ptcwriteoid, "
6855 " ptcvalidatorfn as ptcvaloid, "
6856 " (%s ptc.ptcowner) as rolname, "
6857 " ptc.ptctrusted as ptctrusted, "
6858 " %s AS ptcacl, "
6859 " %s AS ptcracl, "
6860 " %s AS ptcinitacl, "
6861 " %s AS ptcinitracl "
6862 "FROM pg_extprotocol ptc "
6863 "LEFT JOIN pg_init_privs pip ON "
6864 " (ptc.oid = pip.objoid "
6865 " AND pip.classoid = 'pg_extprotocol'::regclass "
6866 " AND pip.objsubid = 0)",
6867 username_subquery,
6868 acl_subquery->data,
6869 racl_subquery->data,
6870 initacl_subquery->data,
6871 initracl_subquery->data);
6872

Callers 1

getSchemaDataFunction · 0.85

Calls 14

createPQExpBufferFunction · 0.85
buildACLQueriesFunction · 0.85
appendPQExpBufferFunction · 0.85
destroyPQExpBufferFunction · 0.85
ExecuteSqlQueryFunction · 0.85
PQntuplesFunction · 0.85
pg_mallocFunction · 0.85
PQfnumberFunction · 0.85
PQgetvalueFunction · 0.85
AssignDumpIdFunction · 0.85
pg_strdupFunction · 0.85
PQgetisnullFunction · 0.85

Tested by

no test coverage detected