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

Function dumpExtProtocol

src/bin/pg_dump/pg_dump.c:15908–16085  ·  view source on GitHub ↗

* dumpExtProtocol * write out a single external protocol definition */

Source from the content-addressed store, hash-verified

15906 * write out a single external protocol definition
15907 */
15908static void
15909dumpExtProtocol(Archive *fout, const ExtProtInfo *ptcinfo)
15910{
15911#define FCOUNT 3
15912#define READFN_IDX 0
15913#define WRITEFN_IDX 1
15914#define VALIDFN_IDX 2
15915
15916 typedef struct
15917 {
15918 Oid oid; /* func's oid */
15919 char* name; /* func name */
15920 FuncInfo* pfuncinfo; /* FuncInfo ptr */
15921 bool dumpable; /* should we dump this function */
15922 bool internal; /* is it an internal function */
15923 } ProtoFunc;
15924
15925 ProtoFunc protoFuncs[FCOUNT];
15926
15927 PQExpBuffer q;
15928 PQExpBuffer delq;
15929 PQExpBuffer nsq;
15930 char *prev_ns;
15931 char *namecopy;
15932 int i;
15933 bool has_internal = false;
15934
15935 /* Skip if not to be dumped */
15936 if (!ptcinfo->dobj.dump || fout->dopt->dataOnly)
15937 return;
15938
15939 /* init and fill the protoFuncs array */
15940 memset(protoFuncs, 0, sizeof(protoFuncs));
15941 protoFuncs[READFN_IDX].oid = ptcinfo->ptcreadid;
15942 protoFuncs[WRITEFN_IDX].oid = ptcinfo->ptcwriteid;
15943 protoFuncs[VALIDFN_IDX].oid = ptcinfo->ptcvalidid;
15944
15945 for (i = 0; i < FCOUNT; i++)
15946 {
15947 if (protoFuncs[i].oid == InvalidOid)
15948 {
15949 protoFuncs[i].dumpable = false;
15950 protoFuncs[i].internal = true;
15951 /*
15952 * We have at least one internal function, signal that we need the
15953 * public schema in the search_path
15954 */
15955 has_internal = true;
15956 }
15957 else
15958 {
15959 protoFuncs[i].pfuncinfo = findFuncByOid(protoFuncs[i].oid);
15960 if (protoFuncs[i].pfuncinfo != NULL)
15961 {
15962 protoFuncs[i].dumpable = true;
15963 protoFuncs[i].name = pg_strdup(protoFuncs[i].pfuncinfo->dobj.name);
15964 protoFuncs[i].internal = false;
15965 }

Callers 1

dumpDumpableObjectFunction · 0.85

Calls 10

findFuncByOidFunction · 0.85
pg_strdupFunction · 0.85
getFunctionNameFunction · 0.85
createPQExpBufferFunction · 0.85
appendPQExpBufferFunction · 0.85
appendPQExpBufferStrFunction · 0.85
destroyPQExpBufferFunction · 0.85
fmtIdFunction · 0.85
ArchiveEntryFunction · 0.85
dumpACLFunction · 0.85

Tested by

no test coverage detected