Commit f831d4ac authored by Alvaro Herrera's avatar Alvaro Herrera

Add ArchiveOpts to pass options to ArchiveEntry

The ArchiveEntry function has a number of arguments that can be
considered optional.  Split them out into a separate struct, to make the
API more flexible for changes.

Author: Dmitry Dolgov
Discussion: https://postgr.es/m/CA+q6zcXRxPE+qp6oerQWJ3zS061WPOhdxeMrdc-Yf-2V5vsrEw@mail.gmail.com
parent 456e3718
...@@ -77,7 +77,7 @@ static ArchiveHandle *_allocAH(const char *FileSpec, const ArchiveFormat fmt, ...@@ -77,7 +77,7 @@ static ArchiveHandle *_allocAH(const char *FileSpec, const ArchiveFormat fmt,
static void _getObjectDescription(PQExpBuffer buf, TocEntry *te, static void _getObjectDescription(PQExpBuffer buf, TocEntry *te,
ArchiveHandle *AH); ArchiveHandle *AH);
static void _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData); static void _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData);
static char *replace_line_endings(const char *str); static char *sanitize_line(const char *str, bool want_hyphen);
static void _doSetFixedOutputState(ArchiveHandle *AH); static void _doSetFixedOutputState(ArchiveHandle *AH);
static void _doSetSessionAuth(ArchiveHandle *AH, const char *user); static void _doSetSessionAuth(ArchiveHandle *AH, const char *user);
static void _reconnectToDB(ArchiveHandle *AH, const char *dbname); static void _reconnectToDB(ArchiveHandle *AH, const char *dbname);
...@@ -1066,17 +1066,8 @@ WriteData(Archive *AHX, const void *data, size_t dLen) ...@@ -1066,17 +1066,8 @@ WriteData(Archive *AHX, const void *data, size_t dLen)
/* Public */ /* Public */
TocEntry * TocEntry *
ArchiveEntry(Archive *AHX, ArchiveEntry(Archive *AHX, CatalogId catalogId, DumpId dumpId,
CatalogId catalogId, DumpId dumpId, ArchiveOpts *opts)
const char *tag,
const char *namespace,
const char *tablespace,
const char *owner,
const char *desc, teSection section,
const char *defn,
const char *dropStmt, const char *copyStmt,
const DumpId *deps, int nDeps,
DataDumperPtr dumpFn, void *dumpArg)
{ {
ArchiveHandle *AH = (ArchiveHandle *) AHX; ArchiveHandle *AH = (ArchiveHandle *) AHX;
TocEntry *newToc; TocEntry *newToc;
...@@ -1094,22 +1085,22 @@ ArchiveEntry(Archive *AHX, ...@@ -1094,22 +1085,22 @@ ArchiveEntry(Archive *AHX,
newToc->catalogId = catalogId; newToc->catalogId = catalogId;
newToc->dumpId = dumpId; newToc->dumpId = dumpId;
newToc->section = section; newToc->section = opts->section;
newToc->tag = pg_strdup(tag); newToc->tag = pg_strdup(opts->tag);
newToc->namespace = namespace ? pg_strdup(namespace) : NULL; newToc->namespace = opts->namespace ? pg_strdup(opts->namespace) : NULL;
newToc->tablespace = tablespace ? pg_strdup(tablespace) : NULL; newToc->tablespace = opts->tablespace ? pg_strdup(opts->tablespace) : NULL;
newToc->owner = pg_strdup(owner); newToc->owner = opts->owner ? pg_strdup(opts->owner) : NULL;
newToc->desc = pg_strdup(desc); newToc->desc = pg_strdup(opts->description);
newToc->defn = pg_strdup(defn); newToc->defn = opts->createStmt ? pg_strdup(opts->createStmt) : NULL;
newToc->dropStmt = pg_strdup(dropStmt); newToc->dropStmt = opts->dropStmt ? pg_strdup(opts->dropStmt) : NULL;
newToc->copyStmt = copyStmt ? pg_strdup(copyStmt) : NULL; newToc->copyStmt = opts->copyStmt ? pg_strdup(opts->copyStmt) : NULL;
if (nDeps > 0) if (opts->nDeps > 0)
{ {
newToc->dependencies = (DumpId *) pg_malloc(nDeps * sizeof(DumpId)); newToc->dependencies = (DumpId *) pg_malloc(opts->nDeps * sizeof(DumpId));
memcpy(newToc->dependencies, deps, nDeps * sizeof(DumpId)); memcpy(newToc->dependencies, opts->deps, opts->nDeps * sizeof(DumpId));
newToc->nDeps = nDeps; newToc->nDeps = opts->nDeps;
} }
else else
{ {
...@@ -1117,9 +1108,9 @@ ArchiveEntry(Archive *AHX, ...@@ -1117,9 +1108,9 @@ ArchiveEntry(Archive *AHX,
newToc->nDeps = 0; newToc->nDeps = 0;
} }
newToc->dataDumper = dumpFn; newToc->dataDumper = opts->dumpFn;
newToc->dataDumperArg = dumpArg; newToc->dataDumperArg = opts->dumpArg;
newToc->hadDumper = dumpFn ? true : false; newToc->hadDumper = opts->dumpFn ? true : false;
newToc->formatData = NULL; newToc->formatData = NULL;
newToc->dataLength = 0; newToc->dataLength = 0;
...@@ -1152,7 +1143,7 @@ PrintTOCSummary(Archive *AHX) ...@@ -1152,7 +1143,7 @@ PrintTOCSummary(Archive *AHX)
ahprintf(AH, ";\n; Archive created at %s\n", stamp_str); ahprintf(AH, ";\n; Archive created at %s\n", stamp_str);
ahprintf(AH, "; dbname: %s\n; TOC Entries: %d\n; Compression: %d\n", ahprintf(AH, "; dbname: %s\n; TOC Entries: %d\n; Compression: %d\n",
replace_line_endings(AH->archdbname), sanitize_line(AH->archdbname, false),
AH->tocCount, AH->compression); AH->tocCount, AH->compression);
switch (AH->format) switch (AH->format)
...@@ -1197,21 +1188,10 @@ PrintTOCSummary(Archive *AHX) ...@@ -1197,21 +1188,10 @@ PrintTOCSummary(Archive *AHX)
char *sanitized_owner; char *sanitized_owner;
/* /*
* As in _printTocEntry(), sanitize strings that might contain
* newlines, to ensure that each logical output line is in fact
* one physical output line. This prevents confusion when the
* file is read by "pg_restore -L". Note that we currently don't
* bother to quote names, meaning that the name fields aren't
* automatically parseable. "pg_restore -L" doesn't care because
* it only examines the dumpId field, but someday we might want to
* try harder.
*/ */
sanitized_name = replace_line_endings(te->tag); sanitized_name = sanitize_line(te->tag, false);
if (te->namespace) sanitized_schema = sanitize_line(te->namespace, true);
sanitized_schema = replace_line_endings(te->namespace); sanitized_owner = sanitize_line(te->owner, false);
else
sanitized_schema = pg_strdup("-");
sanitized_owner = replace_line_endings(te->owner);
ahprintf(AH, "%d; %u %u %s %s %s %s\n", te->dumpId, ahprintf(AH, "%d; %u %u %s %s %s %s\n", te->dumpId,
te->catalogId.tableoid, te->catalogId.oid, te->catalogId.tableoid, te->catalogId.oid,
...@@ -3577,21 +3557,9 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData) ...@@ -3577,21 +3557,9 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData)
} }
} }
/* sanitized_name = sanitize_line(te->tag, false);
* Zap any line endings embedded in user-supplied fields, to prevent sanitized_schema = sanitize_line(te->namespace, true);
* corruption of the dump (which could, in the worst case, present an sanitized_owner = sanitize_line(ropt->noOwner ? NULL : te->owner, true);
* SQL injection vulnerability if someone were to incautiously load a
* dump containing objects with maliciously crafted names).
*/
sanitized_name = replace_line_endings(te->tag);
if (te->namespace)
sanitized_schema = replace_line_endings(te->namespace);
else
sanitized_schema = pg_strdup("-");
if (!ropt->noOwner)
sanitized_owner = replace_line_endings(te->owner);
else
sanitized_owner = pg_strdup("-");
ahprintf(AH, "-- %sName: %s; Type: %s; Schema: %s; Owner: %s", ahprintf(AH, "-- %sName: %s; Type: %s; Schema: %s; Owner: %s",
pfx, sanitized_name, te->desc, sanitized_schema, pfx, sanitized_name, te->desc, sanitized_schema,
...@@ -3605,7 +3573,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData) ...@@ -3605,7 +3573,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData)
{ {
char *sanitized_tablespace; char *sanitized_tablespace;
sanitized_tablespace = replace_line_endings(te->tablespace); sanitized_tablespace = sanitize_line(te->tablespace, false);
ahprintf(AH, "; Tablespace: %s", sanitized_tablespace); ahprintf(AH, "; Tablespace: %s", sanitized_tablespace);
free(sanitized_tablespace); free(sanitized_tablespace);
} }
...@@ -3629,7 +3597,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData) ...@@ -3629,7 +3597,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData)
} }
else else
{ {
if (strlen(te->defn) > 0) if (te->defn && strlen(te->defn) > 0)
ahprintf(AH, "%s\n\n", te->defn); ahprintf(AH, "%s\n\n", te->defn);
} }
...@@ -3640,7 +3608,8 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData) ...@@ -3640,7 +3608,8 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData)
* with DROP commands must appear in one list or the other. * with DROP commands must appear in one list or the other.
*/ */
if (!ropt->noOwner && !ropt->use_setsessauth && if (!ropt->noOwner && !ropt->use_setsessauth &&
strlen(te->owner) > 0 && strlen(te->dropStmt) > 0) te->owner && strlen(te->owner) > 0 &&
te->dropStmt && strlen(te->dropStmt) > 0)
{ {
if (strcmp(te->desc, "AGGREGATE") == 0 || if (strcmp(te->desc, "AGGREGATE") == 0 ||
strcmp(te->desc, "BLOB") == 0 || strcmp(te->desc, "BLOB") == 0 ||
...@@ -3713,16 +3682,30 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData) ...@@ -3713,16 +3682,30 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, bool isData)
} }
/* /*
* Sanitize a string to be included in an SQL comment or TOC listing, * Sanitize a string to be included in an SQL comment or TOC listing, by
* by replacing any newlines with spaces. * replacing any newlines with spaces. This ensures each logical output line
* The result is a freshly malloc'd string. * is in fact one physical output line, to prevent corruption of the dump
* (which could, in the worst case, present an SQL injection vulnerability
* if someone were to incautiously load a dump containing objects with
* maliciously crafted names).
*
* The result is a freshly malloc'd string. If the input string is NULL,
* return a malloc'ed empty string, unless want_hyphen, in which case return a
* malloc'ed hyphen.
*
* Note that we currently don't bother to quote names, meaning that the name
* fields aren't automatically parseable. "pg_restore -L" doesn't care because
* it only examines the dumpId field, but someday we might want to try harder.
*/ */
static char * static char *
replace_line_endings(const char *str) sanitize_line(const char *str, bool want_hyphen)
{ {
char *result; char *result;
char *s; char *s;
if (!str)
return pg_strdup(want_hyphen ? "-" : "");
result = pg_strdup(str); result = pg_strdup(str);
for (s = result; *s != '\0'; s++) for (s = result; *s != '\0'; s++)
......
...@@ -405,17 +405,27 @@ extern void on_exit_close_archive(Archive *AHX); ...@@ -405,17 +405,27 @@ extern void on_exit_close_archive(Archive *AHX);
extern void warn_or_exit_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt,...) pg_attribute_printf(3, 4); extern void warn_or_exit_horribly(ArchiveHandle *AH, const char *modulename, const char *fmt,...) pg_attribute_printf(3, 4);
/* Options for ArchiveEntry */
typedef struct _archiveOpts
{
const char *tag;
const char *namespace;
const char *tablespace;
const char *owner;
const char *description;
teSection section;
const char *createStmt;
const char *dropStmt;
const char *copyStmt;
const DumpId *deps;
int nDeps;
DataDumperPtr dumpFn;
void *dumpArg;
} ArchiveOpts;
#define ARCHIVE_OPTS(...) &(ArchiveOpts){__VA_ARGS__}
/* Called to add a TOC entry */ /* Called to add a TOC entry */
extern TocEntry *ArchiveEntry(Archive *AHX, extern TocEntry *ArchiveEntry(Archive *AHX, CatalogId catalogId,
CatalogId catalogId, DumpId dumpId, DumpId dumpId, ArchiveOpts *opts);
const char *tag,
const char *namespace, const char *tablespace,
const char *owner,
const char *desc, teSection section,
const char *defn,
const char *dropStmt, const char *copyStmt,
const DumpId *deps, int nDeps,
DataDumperPtr dumpFn, void *dumpArg);
extern void WriteTOC(ArchiveHandle *AH); extern void WriteTOC(ArchiveHandle *AH);
extern void ReadTOC(ArchiveHandle *AH); extern void ReadTOC(ArchiveHandle *AH);
......
...@@ -2135,12 +2135,16 @@ dumpTableData(Archive *fout, TableDataInfo *tdinfo) ...@@ -2135,12 +2135,16 @@ dumpTableData(Archive *fout, TableDataInfo *tdinfo)
TocEntry *te; TocEntry *te;
te = ArchiveEntry(fout, tdinfo->dobj.catId, tdinfo->dobj.dumpId, te = ArchiveEntry(fout, tdinfo->dobj.catId, tdinfo->dobj.dumpId,
tbinfo->dobj.name, tbinfo->dobj.namespace->dobj.name, ARCHIVE_OPTS(.tag = tbinfo->dobj.name,
NULL, tbinfo->rolname, .namespace = tbinfo->dobj.namespace->dobj.name,
"TABLE DATA", SECTION_DATA, .owner = tbinfo->rolname,
"", "", copyStmt, .description = "TABLE DATA",
&(tbinfo->dobj.dumpId), 1, .section = SECTION_DATA,
dumpFn, tdinfo); .copyStmt = copyStmt,
.deps = &(tbinfo->dobj.dumpId),
.nDeps = 1,
.dumpFn = dumpFn,
.dumpArg = tdinfo));
/* /*
* Set the TocEntry's dataLength in case we are doing a parallel dump * Set the TocEntry's dataLength in case we are doing a parallel dump
...@@ -2184,19 +2188,14 @@ refreshMatViewData(Archive *fout, TableDataInfo *tdinfo) ...@@ -2184,19 +2188,14 @@ refreshMatViewData(Archive *fout, TableDataInfo *tdinfo)
ArchiveEntry(fout, ArchiveEntry(fout,
tdinfo->dobj.catId, /* catalog ID */ tdinfo->dobj.catId, /* catalog ID */
tdinfo->dobj.dumpId, /* dump ID */ tdinfo->dobj.dumpId, /* dump ID */
tbinfo->dobj.name, /* Name */ ARCHIVE_OPTS(.tag = tbinfo->dobj.name,
tbinfo->dobj.namespace->dobj.name, /* Namespace */ .namespace = tbinfo->dobj.namespace->dobj.name,
NULL, /* Tablespace */ .owner = tbinfo->rolname,
tbinfo->rolname, /* Owner */ .description = "MATERIALIZED VIEW DATA",
"MATERIALIZED VIEW DATA", /* Desc */ .section = SECTION_POST_DATA,
SECTION_POST_DATA, /* Section */ .createStmt = q->data,
q->data, /* Create */ .deps = tdinfo->dobj.dependencies,
"", /* Del */ .nDeps = tdinfo->dobj.nDeps));
NULL, /* Copy */
tdinfo->dobj.dependencies, /* Deps */
tdinfo->dobj.nDeps, /* # Deps */
NULL, /* Dumper */
NULL); /* Dumper Arg */
destroyPQExpBuffer(q); destroyPQExpBuffer(q);
} }
...@@ -2722,19 +2721,12 @@ dumpDatabase(Archive *fout) ...@@ -2722,19 +2721,12 @@ dumpDatabase(Archive *fout)
ArchiveEntry(fout, ArchiveEntry(fout,
dbCatId, /* catalog ID */ dbCatId, /* catalog ID */
dbDumpId, /* dump ID */ dbDumpId, /* dump ID */
datname, /* Name */ ARCHIVE_OPTS(.tag = datname,
NULL, /* Namespace */ .owner = dba,
NULL, /* Tablespace */ .description = "DATABASE",
dba, /* Owner */ .section = SECTION_PRE_DATA,
"DATABASE", /* Desc */ .createStmt = creaQry->data,
SECTION_PRE_DATA, /* Section */ .dropStmt = delQry->data));
creaQry->data, /* Create */
delQry->data, /* Del */
NULL, /* Copy */
NULL, /* Deps */
0, /* # Deps */
NULL, /* Dumper */
NULL); /* Dumper Arg */
/* Compute correct tag for archive entry */ /* Compute correct tag for archive entry */
appendPQExpBuffer(labelq, "DATABASE %s", qdatname); appendPQExpBuffer(labelq, "DATABASE %s", qdatname);
...@@ -2762,11 +2754,13 @@ dumpDatabase(Archive *fout) ...@@ -2762,11 +2754,13 @@ dumpDatabase(Archive *fout)
appendPQExpBufferStr(dbQry, ";\n"); appendPQExpBufferStr(dbQry, ";\n");
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
labelq->data, NULL, NULL, dba, ARCHIVE_OPTS(.tag = labelq->data,
"COMMENT", SECTION_NONE, .owner = dba,
dbQry->data, "", NULL, .description = "COMMENT",
&(dbDumpId), 1, .section = SECTION_NONE,
NULL, NULL); .createStmt = dbQry->data,
.deps = &dbDumpId,
.nDeps = 1));
} }
} }
else else
...@@ -2789,11 +2783,13 @@ dumpDatabase(Archive *fout) ...@@ -2789,11 +2783,13 @@ dumpDatabase(Archive *fout)
emitShSecLabels(conn, shres, seclabelQry, "DATABASE", datname); emitShSecLabels(conn, shres, seclabelQry, "DATABASE", datname);
if (seclabelQry->len > 0) if (seclabelQry->len > 0)
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
labelq->data, NULL, NULL, dba, ARCHIVE_OPTS(.tag = labelq->data,
"SECURITY LABEL", SECTION_NONE, .owner = dba,
seclabelQry->data, "", NULL, .description = "SECURITY LABEL",
&(dbDumpId), 1, .section = SECTION_NONE,
NULL, NULL); .createStmt = seclabelQry->data,
.deps = &dbDumpId,
.nDeps = 1));
destroyPQExpBuffer(seclabelQry); destroyPQExpBuffer(seclabelQry);
PQclear(shres); PQclear(shres);
} }
...@@ -2859,11 +2855,13 @@ dumpDatabase(Archive *fout) ...@@ -2859,11 +2855,13 @@ dumpDatabase(Archive *fout)
if (creaQry->len > 0) if (creaQry->len > 0)
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
datname, NULL, NULL, dba, ARCHIVE_OPTS(.tag = datname,
"DATABASE PROPERTIES", SECTION_PRE_DATA, .owner = dba,
creaQry->data, delQry->data, NULL, .description = "DATABASE PROPERTIES",
&(dbDumpId), 1, .section = SECTION_PRE_DATA,
NULL, NULL); .createStmt = creaQry->data,
.dropStmt = delQry->data,
.deps = &dbDumpId));
/* /*
* pg_largeobject comes from the old system intact, so set its * pg_largeobject comes from the old system intact, so set its
...@@ -2904,11 +2902,10 @@ dumpDatabase(Archive *fout) ...@@ -2904,11 +2902,10 @@ dumpDatabase(Archive *fout)
atooid(PQgetvalue(lo_res, 0, i_relminmxid)), atooid(PQgetvalue(lo_res, 0, i_relminmxid)),
LargeObjectRelationId); LargeObjectRelationId);
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
"pg_largeobject", NULL, NULL, "", ARCHIVE_OPTS(.tag = "pg_largeobject",
"pg_largeobject", SECTION_PRE_DATA, .description = "pg_largeobject",
loOutQry->data, "", NULL, .section = SECTION_PRE_DATA,
NULL, 0, .createStmt = loOutQry->data));
NULL, NULL);
PQclear(lo_res); PQclear(lo_res);
...@@ -3014,11 +3011,10 @@ dumpEncoding(Archive *AH) ...@@ -3014,11 +3011,10 @@ dumpEncoding(Archive *AH)
appendPQExpBufferStr(qry, ";\n"); appendPQExpBufferStr(qry, ";\n");
ArchiveEntry(AH, nilCatalogId, createDumpId(), ArchiveEntry(AH, nilCatalogId, createDumpId(),
"ENCODING", NULL, NULL, "", ARCHIVE_OPTS(.tag = "ENCODING",
"ENCODING", SECTION_PRE_DATA, .description = "ENCODING",
qry->data, "", NULL, .section = SECTION_PRE_DATA,
NULL, 0, .createStmt = qry->data));
NULL, NULL);
destroyPQExpBuffer(qry); destroyPQExpBuffer(qry);
} }
...@@ -3041,11 +3037,10 @@ dumpStdStrings(Archive *AH) ...@@ -3041,11 +3037,10 @@ dumpStdStrings(Archive *AH)
stdstrings); stdstrings);
ArchiveEntry(AH, nilCatalogId, createDumpId(), ArchiveEntry(AH, nilCatalogId, createDumpId(),
"STDSTRINGS", NULL, NULL, "", ARCHIVE_OPTS(.tag = "STDSTRINGS",
"STDSTRINGS", SECTION_PRE_DATA, .description = "STDSTRINGS",
qry->data, "", NULL, .section = SECTION_PRE_DATA,
NULL, 0, .createStmt = qry->data));
NULL, NULL);
destroyPQExpBuffer(qry); destroyPQExpBuffer(qry);
} }
...@@ -3097,11 +3092,10 @@ dumpSearchPath(Archive *AH) ...@@ -3097,11 +3092,10 @@ dumpSearchPath(Archive *AH)
write_msg(NULL, "saving search_path = %s\n", path->data); write_msg(NULL, "saving search_path = %s\n", path->data);
ArchiveEntry(AH, nilCatalogId, createDumpId(), ArchiveEntry(AH, nilCatalogId, createDumpId(),
"SEARCHPATH", NULL, NULL, "", ARCHIVE_OPTS(.tag = "SEARCHPATH",
"SEARCHPATH", SECTION_PRE_DATA, .description = "SEARCHPATH",
qry->data, "", NULL, .section = SECTION_PRE_DATA,
NULL, 0, .createStmt = qry->data));
NULL, NULL);
/* Also save it in AH->searchpath, in case we're doing plain text dump */ /* Also save it in AH->searchpath, in case we're doing plain text dump */
AH->searchpath = pg_strdup(qry->data); AH->searchpath = pg_strdup(qry->data);
...@@ -3273,13 +3267,12 @@ dumpBlob(Archive *fout, BlobInfo *binfo) ...@@ -3273,13 +3267,12 @@ dumpBlob(Archive *fout, BlobInfo *binfo)
if (binfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (binfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, binfo->dobj.catId, binfo->dobj.dumpId, ArchiveEntry(fout, binfo->dobj.catId, binfo->dobj.dumpId,
binfo->dobj.name, ARCHIVE_OPTS(.tag = binfo->dobj.name,
NULL, NULL, .owner = binfo->rolname,
binfo->rolname, .description = "BLOB",
"BLOB", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
cquery->data, dquery->data, NULL, .createStmt = cquery->data,
NULL, 0, .dropStmt = dquery->data));
NULL, NULL);
/* Dump comment if any */ /* Dump comment if any */
if (binfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (binfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -3577,14 +3570,14 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo) ...@@ -3577,14 +3570,14 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo)
*/ */
if (polinfo->dobj.dump & DUMP_COMPONENT_POLICY) if (polinfo->dobj.dump & DUMP_COMPONENT_POLICY)
ArchiveEntry(fout, polinfo->dobj.catId, polinfo->dobj.dumpId, ArchiveEntry(fout, polinfo->dobj.catId, polinfo->dobj.dumpId,
polinfo->dobj.name, ARCHIVE_OPTS(.tag = polinfo->dobj.name,
polinfo->dobj.namespace->dobj.name, .namespace = polinfo->dobj.namespace->dobj.name,
NULL, .owner = tbinfo->rolname,
tbinfo->rolname, .description = "ROW SECURITY",
"ROW SECURITY", SECTION_POST_DATA, .section = SECTION_POST_DATA,
query->data, "", NULL, .createStmt = query->data,
&(tbinfo->dobj.dumpId), 1, .deps = &(tbinfo->dobj.dumpId),
NULL, NULL); .nDeps = 1));
destroyPQExpBuffer(query); destroyPQExpBuffer(query);
return; return;
...@@ -3633,14 +3626,13 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo) ...@@ -3633,14 +3626,13 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo)
if (polinfo->dobj.dump & DUMP_COMPONENT_POLICY) if (polinfo->dobj.dump & DUMP_COMPONENT_POLICY)
ArchiveEntry(fout, polinfo->dobj.catId, polinfo->dobj.dumpId, ArchiveEntry(fout, polinfo->dobj.catId, polinfo->dobj.dumpId,
tag, ARCHIVE_OPTS(.tag = tag,
polinfo->dobj.namespace->dobj.name, .namespace = polinfo->dobj.namespace->dobj.name,
NULL, .owner = tbinfo->rolname,
tbinfo->rolname, .description = "POLICY",
"POLICY", SECTION_POST_DATA, .section = SECTION_POST_DATA,
query->data, delqry->data, NULL, .createStmt = query->data,
NULL, 0, .dropStmt = delqry->data));
NULL, NULL);
free(tag); free(tag);
destroyPQExpBuffer(query); destroyPQExpBuffer(query);
...@@ -3807,14 +3799,12 @@ dumpPublication(Archive *fout, PublicationInfo *pubinfo) ...@@ -3807,14 +3799,12 @@ dumpPublication(Archive *fout, PublicationInfo *pubinfo)
appendPQExpBufferStr(query, "');\n"); appendPQExpBufferStr(query, "');\n");
ArchiveEntry(fout, pubinfo->dobj.catId, pubinfo->dobj.dumpId, ArchiveEntry(fout, pubinfo->dobj.catId, pubinfo->dobj.dumpId,
pubinfo->dobj.name, ARCHIVE_OPTS(.tag = pubinfo->dobj.name,
NULL, .owner = pubinfo->rolname,
NULL, .description = "PUBLICATION",
pubinfo->rolname, .section = SECTION_POST_DATA,
"PUBLICATION", SECTION_POST_DATA, .createStmt = query->data,
query->data, delq->data, NULL, .dropStmt = delq->data));
NULL, 0,
NULL, NULL);
if (pubinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (pubinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
dumpComment(fout, "PUBLICATION", qpubname, dumpComment(fout, "PUBLICATION", qpubname,
...@@ -3950,14 +3940,11 @@ dumpPublicationTable(Archive *fout, PublicationRelInfo *pubrinfo) ...@@ -3950,14 +3940,11 @@ dumpPublicationTable(Archive *fout, PublicationRelInfo *pubrinfo)
* done by table drop. * done by table drop.
*/ */
ArchiveEntry(fout, pubrinfo->dobj.catId, pubrinfo->dobj.dumpId, ArchiveEntry(fout, pubrinfo->dobj.catId, pubrinfo->dobj.dumpId,
tag, ARCHIVE_OPTS(.tag = tag,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
NULL, .description = "PUBLICATION TABLE",
"", .section = SECTION_POST_DATA,
"PUBLICATION TABLE", SECTION_POST_DATA, .createStmt = query->data));
query->data, "", NULL,
NULL, 0,
NULL, NULL);
free(tag); free(tag);
destroyPQExpBuffer(query); destroyPQExpBuffer(query);
...@@ -4143,14 +4130,12 @@ dumpSubscription(Archive *fout, SubscriptionInfo *subinfo) ...@@ -4143,14 +4130,12 @@ dumpSubscription(Archive *fout, SubscriptionInfo *subinfo)
appendPQExpBufferStr(query, ");\n"); appendPQExpBufferStr(query, ");\n");
ArchiveEntry(fout, subinfo->dobj.catId, subinfo->dobj.dumpId, ArchiveEntry(fout, subinfo->dobj.catId, subinfo->dobj.dumpId,
subinfo->dobj.name, ARCHIVE_OPTS(.tag = subinfo->dobj.name,
NULL, .owner = subinfo->rolname,
NULL, .description = "SUBSCRIPTION",
subinfo->rolname, .section = SECTION_POST_DATA,
"SUBSCRIPTION", SECTION_POST_DATA, .createStmt = query->data,
query->data, delq->data, NULL, .dropStmt = delq->data));
NULL, 0,
NULL, NULL);
if (subinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (subinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
dumpComment(fout, "SUBSCRIPTION", qsubname, dumpComment(fout, "SUBSCRIPTION", qsubname,
...@@ -9377,11 +9362,14 @@ dumpComment(Archive *fout, const char *type, const char *name, ...@@ -9377,11 +9362,14 @@ dumpComment(Archive *fout, const char *type, const char *name,
* post-data. * post-data.
*/ */
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
tag->data, namespace, NULL, owner, ARCHIVE_OPTS(.tag = tag->data,
"COMMENT", SECTION_NONE, .namespace = namespace,
query->data, "", NULL, .owner = owner,
&(dumpId), 1, .description = "COMMENT",
NULL, NULL); .section = SECTION_NONE,
.createStmt = query->data,
.deps = &dumpId,
.nDeps = 1));
destroyPQExpBuffer(query); destroyPQExpBuffer(query);
destroyPQExpBuffer(tag); destroyPQExpBuffer(tag);
...@@ -9443,13 +9431,14 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo, ...@@ -9443,13 +9431,14 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo,
appendPQExpBufferStr(query, ";\n"); appendPQExpBufferStr(query, ";\n");
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
tag->data, ARCHIVE_OPTS(.tag = tag->data,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
NULL, tbinfo->rolname, .owner = tbinfo->rolname,
"COMMENT", SECTION_NONE, .description = "COMMENT",
query->data, "", NULL, .section = SECTION_NONE,
&(tbinfo->dobj.dumpId), 1, .createStmt = query->data,
NULL, NULL); .deps = &(tbinfo->dobj.dumpId),
.nDeps = 1));
} }
else if (objsubid > 0 && objsubid <= tbinfo->numatts) else if (objsubid > 0 && objsubid <= tbinfo->numatts)
{ {
...@@ -9467,13 +9456,14 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo, ...@@ -9467,13 +9456,14 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo,
appendPQExpBufferStr(query, ";\n"); appendPQExpBufferStr(query, ";\n");
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
tag->data, ARCHIVE_OPTS(.tag = tag->data,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
NULL, tbinfo->rolname, .owner = tbinfo->rolname,
"COMMENT", SECTION_NONE, .description = "COMMENT",
query->data, "", NULL, .section = SECTION_NONE,
&(tbinfo->dobj.dumpId), 1, .createStmt = query->data,
NULL, NULL); .deps = &(tbinfo->dobj.dumpId),
.nDeps = 1));
} }
comments++; comments++;
...@@ -9750,11 +9740,10 @@ dumpDumpableObject(Archive *fout, DumpableObject *dobj) ...@@ -9750,11 +9740,10 @@ dumpDumpableObject(Archive *fout, DumpableObject *dobj)
TocEntry *te; TocEntry *te;
te = ArchiveEntry(fout, dobj->catId, dobj->dumpId, te = ArchiveEntry(fout, dobj->catId, dobj->dumpId,
dobj->name, NULL, NULL, "", ARCHIVE_OPTS(.tag = dobj->name,
"BLOBS", SECTION_DATA, .description = "BLOBS",
"", "", NULL, .section = SECTION_DATA,
NULL, 0, .dumpFn = dumpBlobs));
dumpBlobs, NULL);
/* /*
* Set the TocEntry's dataLength in case we are doing a * Set the TocEntry's dataLength in case we are doing a
...@@ -9822,13 +9811,12 @@ dumpNamespace(Archive *fout, NamespaceInfo *nspinfo) ...@@ -9822,13 +9811,12 @@ dumpNamespace(Archive *fout, NamespaceInfo *nspinfo)
if (nspinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (nspinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, nspinfo->dobj.catId, nspinfo->dobj.dumpId, ArchiveEntry(fout, nspinfo->dobj.catId, nspinfo->dobj.dumpId,
nspinfo->dobj.name, ARCHIVE_OPTS(.tag = nspinfo->dobj.name,
NULL, NULL, .owner = nspinfo->rolname,
nspinfo->rolname, .description = "SCHEMA",
"SCHEMA", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Schema Comments and Security Labels */ /* Dump Schema Comments and Security Labels */
if (nspinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (nspinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -9958,13 +9946,11 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo) ...@@ -9958,13 +9946,11 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo)
if (extinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (extinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, extinfo->dobj.catId, extinfo->dobj.dumpId, ArchiveEntry(fout, extinfo->dobj.catId, extinfo->dobj.dumpId,
extinfo->dobj.name, ARCHIVE_OPTS(.tag = extinfo->dobj.name,
NULL, NULL, .description = "EXTENSION",
"", .section = SECTION_PRE_DATA,
"EXTENSION", SECTION_PRE_DATA, .createStmt = q->data,
q->data, delq->data, NULL, .dropStmt = delq->data));
NULL, 0,
NULL, NULL);
/* Dump Extension Comments and Security Labels */ /* Dump Extension Comments and Security Labels */
if (extinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (extinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -10108,14 +10094,13 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo) ...@@ -10108,14 +10094,13 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo)
if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId,
tyinfo->dobj.name, ARCHIVE_OPTS(.tag = tyinfo->dobj.name,
tyinfo->dobj.namespace->dobj.name, .namespace = tyinfo->dobj.namespace->dobj.name,
NULL, .owner = tyinfo->rolname,
tyinfo->rolname, .description = "TYPE",
"TYPE", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Type Comments and Security Labels */ /* Dump Type Comments and Security Labels */
if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -10235,14 +10220,13 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo) ...@@ -10235,14 +10220,13 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo)
if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId,
tyinfo->dobj.name, ARCHIVE_OPTS(.tag = tyinfo->dobj.name,
tyinfo->dobj.namespace->dobj.name, .namespace = tyinfo->dobj.namespace->dobj.name,
NULL, .owner = tyinfo->rolname,
tyinfo->rolname, .description = "TYPE",
"TYPE", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Type Comments and Security Labels */ /* Dump Type Comments and Security Labels */
if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -10308,14 +10292,13 @@ dumpUndefinedType(Archive *fout, TypeInfo *tyinfo) ...@@ -10308,14 +10292,13 @@ dumpUndefinedType(Archive *fout, TypeInfo *tyinfo)
if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId,
tyinfo->dobj.name, ARCHIVE_OPTS(.tag = tyinfo->dobj.name,
tyinfo->dobj.namespace->dobj.name, .namespace = tyinfo->dobj.namespace->dobj.name,
NULL, .owner = tyinfo->rolname,
tyinfo->rolname, .description = "TYPE",
"TYPE", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Type Comments and Security Labels */ /* Dump Type Comments and Security Labels */
if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -10590,14 +10573,13 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo) ...@@ -10590,14 +10573,13 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId,
tyinfo->dobj.name, ARCHIVE_OPTS(.tag = tyinfo->dobj.name,
tyinfo->dobj.namespace->dobj.name, .namespace = tyinfo->dobj.namespace->dobj.name,
NULL, .owner = tyinfo->rolname,
tyinfo->rolname, .description = "TYPE",
"TYPE", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Type Comments and Security Labels */ /* Dump Type Comments and Security Labels */
if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -10747,14 +10729,13 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) ...@@ -10747,14 +10729,13 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo)
if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId,
tyinfo->dobj.name, ARCHIVE_OPTS(.tag = tyinfo->dobj.name,
tyinfo->dobj.namespace->dobj.name, .namespace = tyinfo->dobj.namespace->dobj.name,
NULL, .owner = tyinfo->rolname,
tyinfo->rolname, .description = "DOMAIN",
"DOMAIN", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Domain Comments and Security Labels */ /* Dump Domain Comments and Security Labels */
if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (tyinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -10969,14 +10950,13 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) ...@@ -10969,14 +10950,13 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (tyinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId, ArchiveEntry(fout, tyinfo->dobj.catId, tyinfo->dobj.dumpId,
tyinfo->dobj.name, ARCHIVE_OPTS(.tag = tyinfo->dobj.name,
tyinfo->dobj.namespace->dobj.name, .namespace = tyinfo->dobj.namespace->dobj.name,
NULL, .owner = tyinfo->rolname,
tyinfo->rolname, .description = "TYPE",
"TYPE", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Type Comments and Security Labels */ /* Dump Type Comments and Security Labels */
...@@ -11105,13 +11085,14 @@ dumpCompositeTypeColComments(Archive *fout, TypeInfo *tyinfo) ...@@ -11105,13 +11085,14 @@ dumpCompositeTypeColComments(Archive *fout, TypeInfo *tyinfo)
appendPQExpBufferStr(query, ";\n"); appendPQExpBufferStr(query, ";\n");
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
target->data, ARCHIVE_OPTS(.tag = target->data,
tyinfo->dobj.namespace->dobj.name, .namespace = tyinfo->dobj.namespace->dobj.name,
NULL, tyinfo->rolname, .owner = tyinfo->rolname,
"COMMENT", SECTION_NONE, .description = "COMMENT",
query->data, "", NULL, .section = SECTION_NONE,
&(tyinfo->dobj.dumpId), 1, .createStmt = query->data,
NULL, NULL); .deps = &(tyinfo->dobj.dumpId),
.nDeps = 1));
} }
comments++; comments++;
...@@ -11160,14 +11141,12 @@ dumpShellType(Archive *fout, ShellTypeInfo *stinfo) ...@@ -11160,14 +11141,12 @@ dumpShellType(Archive *fout, ShellTypeInfo *stinfo)
if (stinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (stinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, stinfo->dobj.catId, stinfo->dobj.dumpId, ArchiveEntry(fout, stinfo->dobj.catId, stinfo->dobj.dumpId,
stinfo->dobj.name, ARCHIVE_OPTS(.tag = stinfo->dobj.name,
stinfo->dobj.namespace->dobj.name, .namespace = stinfo->dobj.namespace->dobj.name,
NULL, .owner = stinfo->baseType->rolname,
stinfo->baseType->rolname, .description = "SHELL TYPE",
"SHELL TYPE", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, "", NULL, .createStmt = q->data));
NULL, 0,
NULL, NULL);
destroyPQExpBuffer(q); destroyPQExpBuffer(q);
} }
...@@ -11272,12 +11251,13 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang) ...@@ -11272,12 +11251,13 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang)
if (plang->dobj.dump & DUMP_COMPONENT_DEFINITION) if (plang->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, plang->dobj.catId, plang->dobj.dumpId, ArchiveEntry(fout, plang->dobj.catId, plang->dobj.dumpId,
plang->dobj.name, ARCHIVE_OPTS(.tag = plang->dobj.name,
NULL, NULL, plang->lanowner, .owner = plang->lanowner,
"PROCEDURAL LANGUAGE", SECTION_PRE_DATA, .description = "PROCEDURAL LANGUAGE",
defqry->data, delqry->data, NULL, .section = SECTION_PRE_DATA,
NULL, 0, .createStmt = defqry->data,
NULL, NULL); .dropStmt = delqry->data,
));
/* Dump Proc Lang Comments and Security Labels */ /* Dump Proc Lang Comments and Security Labels */
if (plang->dobj.dump & DUMP_COMPONENT_COMMENT) if (plang->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -11942,14 +11922,13 @@ dumpFunc(Archive *fout, FuncInfo *finfo) ...@@ -11942,14 +11922,13 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
if (finfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (finfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, finfo->dobj.catId, finfo->dobj.dumpId, ArchiveEntry(fout, finfo->dobj.catId, finfo->dobj.dumpId,
funcsig_tag, ARCHIVE_OPTS(.tag = funcsig_tag,
finfo->dobj.namespace->dobj.name, .namespace = finfo->dobj.namespace->dobj.name,
NULL, .owner = finfo->rolname,
finfo->rolname, .description = keyword,
keyword, SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delqry->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delqry->data));
NULL, NULL);
/* Dump Function Comments and Security Labels */ /* Dump Function Comments and Security Labels */
if (finfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (finfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -12077,12 +12056,11 @@ dumpCast(Archive *fout, CastInfo *cast) ...@@ -12077,12 +12056,11 @@ dumpCast(Archive *fout, CastInfo *cast)
if (cast->dobj.dump & DUMP_COMPONENT_DEFINITION) if (cast->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, cast->dobj.catId, cast->dobj.dumpId, ArchiveEntry(fout, cast->dobj.catId, cast->dobj.dumpId,
labelq->data, ARCHIVE_OPTS(.tag = labelq->data,
NULL, NULL, "", .description = "CAST",
"CAST", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
defqry->data, delqry->data, NULL, .createStmt = defqry->data,
NULL, 0, .dropStmt = delqry->data));
NULL, NULL);
/* Dump Cast Comments */ /* Dump Cast Comments */
if (cast->dobj.dump & DUMP_COMPONENT_COMMENT) if (cast->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -12205,12 +12183,13 @@ dumpTransform(Archive *fout, TransformInfo *transform) ...@@ -12205,12 +12183,13 @@ dumpTransform(Archive *fout, TransformInfo *transform)
if (transform->dobj.dump & DUMP_COMPONENT_DEFINITION) if (transform->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, transform->dobj.catId, transform->dobj.dumpId, ArchiveEntry(fout, transform->dobj.catId, transform->dobj.dumpId,
labelq->data, ARCHIVE_OPTS(.tag = labelq->data,
NULL, NULL, "", .description = "TRANSFORM",
"TRANSFORM", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
defqry->data, delqry->data, NULL, .createStmt = defqry->data,
transform->dobj.dependencies, transform->dobj.nDeps, .dropStmt = delqry->data,
NULL, NULL); .deps = transform->dobj.dependencies,
.nDeps = transform->dobj.nDeps));
/* Dump Transform Comments */ /* Dump Transform Comments */
if (transform->dobj.dump & DUMP_COMPONENT_COMMENT) if (transform->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -12418,14 +12397,13 @@ dumpOpr(Archive *fout, OprInfo *oprinfo) ...@@ -12418,14 +12397,13 @@ dumpOpr(Archive *fout, OprInfo *oprinfo)
if (oprinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (oprinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, oprinfo->dobj.catId, oprinfo->dobj.dumpId, ArchiveEntry(fout, oprinfo->dobj.catId, oprinfo->dobj.dumpId,
oprinfo->dobj.name, ARCHIVE_OPTS(.tag = oprinfo->dobj.name,
oprinfo->dobj.namespace->dobj.name, .namespace = oprinfo->dobj.namespace->dobj.name,
NULL, .owner = oprinfo->rolname,
oprinfo->rolname, .description = "OPERATOR",
"OPERATOR", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Operator Comments */ /* Dump Operator Comments */
if (oprinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (oprinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -12588,14 +12566,11 @@ dumpAccessMethod(Archive *fout, AccessMethodInfo *aminfo) ...@@ -12588,14 +12566,11 @@ dumpAccessMethod(Archive *fout, AccessMethodInfo *aminfo)
if (aminfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (aminfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, aminfo->dobj.catId, aminfo->dobj.dumpId, ArchiveEntry(fout, aminfo->dobj.catId, aminfo->dobj.dumpId,
aminfo->dobj.name, ARCHIVE_OPTS(.tag = aminfo->dobj.name,
NULL, .description = "ACCESS METHOD",
NULL, .section = SECTION_PRE_DATA,
"", .createStmt = q->data,
"ACCESS METHOD", SECTION_PRE_DATA, .dropStmt = delq->data));
q->data, delq->data, NULL,
NULL, 0,
NULL, NULL);
/* Dump Access Method Comments */ /* Dump Access Method Comments */
if (aminfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (aminfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -12954,14 +12929,13 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) ...@@ -12954,14 +12929,13 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
if (opcinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (opcinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, opcinfo->dobj.catId, opcinfo->dobj.dumpId, ArchiveEntry(fout, opcinfo->dobj.catId, opcinfo->dobj.dumpId,
opcinfo->dobj.name, ARCHIVE_OPTS(.tag = opcinfo->dobj.name,
opcinfo->dobj.namespace->dobj.name, .namespace = opcinfo->dobj.namespace->dobj.name,
NULL, .owner = opcinfo->rolname,
opcinfo->rolname, .description = "OPERATOR CLASS",
"OPERATOR CLASS", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Operator Class Comments */ /* Dump Operator Class Comments */
if (opcinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (opcinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -13221,14 +13195,13 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) ...@@ -13221,14 +13195,13 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo)
if (opfinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (opfinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, opfinfo->dobj.catId, opfinfo->dobj.dumpId, ArchiveEntry(fout, opfinfo->dobj.catId, opfinfo->dobj.dumpId,
opfinfo->dobj.name, ARCHIVE_OPTS(.tag = opfinfo->dobj.name,
opfinfo->dobj.namespace->dobj.name, .namespace = opfinfo->dobj.namespace->dobj.name,
NULL, .owner = opfinfo->rolname,
opfinfo->rolname, .description = "OPERATOR FAMILY",
"OPERATOR FAMILY", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Operator Family Comments */ /* Dump Operator Family Comments */
if (opfinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (opfinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -13364,14 +13337,13 @@ dumpCollation(Archive *fout, CollInfo *collinfo) ...@@ -13364,14 +13337,13 @@ dumpCollation(Archive *fout, CollInfo *collinfo)
if (collinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (collinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, collinfo->dobj.catId, collinfo->dobj.dumpId, ArchiveEntry(fout, collinfo->dobj.catId, collinfo->dobj.dumpId,
collinfo->dobj.name, ARCHIVE_OPTS(.tag = collinfo->dobj.name,
collinfo->dobj.namespace->dobj.name, .namespace = collinfo->dobj.namespace->dobj.name,
NULL, .owner = collinfo->rolname,
collinfo->rolname, .description = "COLLATION",
"COLLATION", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Collation Comments */ /* Dump Collation Comments */
if (collinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (collinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -13459,14 +13431,13 @@ dumpConversion(Archive *fout, ConvInfo *convinfo) ...@@ -13459,14 +13431,13 @@ dumpConversion(Archive *fout, ConvInfo *convinfo)
if (convinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (convinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, convinfo->dobj.catId, convinfo->dobj.dumpId, ArchiveEntry(fout, convinfo->dobj.catId, convinfo->dobj.dumpId,
convinfo->dobj.name, ARCHIVE_OPTS(.tag = convinfo->dobj.name,
convinfo->dobj.namespace->dobj.name, .namespace = convinfo->dobj.namespace->dobj.name,
NULL, .owner = convinfo->rolname,
convinfo->rolname, .description = "CONVERSION",
"CONVERSION", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Conversion Comments */ /* Dump Conversion Comments */
if (convinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (convinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -13948,14 +13919,13 @@ dumpAgg(Archive *fout, AggInfo *agginfo) ...@@ -13948,14 +13919,13 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
if (agginfo->aggfn.dobj.dump & DUMP_COMPONENT_DEFINITION) if (agginfo->aggfn.dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, agginfo->aggfn.dobj.catId, ArchiveEntry(fout, agginfo->aggfn.dobj.catId,
agginfo->aggfn.dobj.dumpId, agginfo->aggfn.dobj.dumpId,
aggsig_tag, ARCHIVE_OPTS(.tag = aggsig_tag,
agginfo->aggfn.dobj.namespace->dobj.name, .namespace = agginfo->aggfn.dobj.namespace->dobj.name,
NULL, .owner = agginfo->aggfn.rolname,
agginfo->aggfn.rolname, .description = "AGGREGATE",
"AGGREGATE", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Aggregate Comments */ /* Dump Aggregate Comments */
if (agginfo->aggfn.dobj.dump & DUMP_COMPONENT_COMMENT) if (agginfo->aggfn.dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -14046,14 +14016,12 @@ dumpTSParser(Archive *fout, TSParserInfo *prsinfo) ...@@ -14046,14 +14016,12 @@ dumpTSParser(Archive *fout, TSParserInfo *prsinfo)
if (prsinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (prsinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, prsinfo->dobj.catId, prsinfo->dobj.dumpId, ArchiveEntry(fout, prsinfo->dobj.catId, prsinfo->dobj.dumpId,
prsinfo->dobj.name, ARCHIVE_OPTS(.tag = prsinfo->dobj.name,
prsinfo->dobj.namespace->dobj.name, .namespace = prsinfo->dobj.namespace->dobj.name,
NULL, .description = "TEXT SEARCH PARSER",
"", .section = SECTION_PRE_DATA,
"TEXT SEARCH PARSER", SECTION_PRE_DATA, .createStmt = q->data,
q->data, delq->data, NULL, .dropStmt = delq->data));
NULL, 0,
NULL, NULL);
/* Dump Parser Comments */ /* Dump Parser Comments */
if (prsinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (prsinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -14126,14 +14094,13 @@ dumpTSDictionary(Archive *fout, TSDictInfo *dictinfo) ...@@ -14126,14 +14094,13 @@ dumpTSDictionary(Archive *fout, TSDictInfo *dictinfo)
if (dictinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (dictinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, dictinfo->dobj.catId, dictinfo->dobj.dumpId, ArchiveEntry(fout, dictinfo->dobj.catId, dictinfo->dobj.dumpId,
dictinfo->dobj.name, ARCHIVE_OPTS(.tag = dictinfo->dobj.name,
dictinfo->dobj.namespace->dobj.name, .namespace = dictinfo->dobj.namespace->dobj.name,
NULL, .owner = dictinfo->rolname,
dictinfo->rolname, .description = "TEXT SEARCH DICTIONARY",
"TEXT SEARCH DICTIONARY", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Dictionary Comments */ /* Dump Dictionary Comments */
if (dictinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (dictinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -14187,14 +14154,12 @@ dumpTSTemplate(Archive *fout, TSTemplateInfo *tmplinfo) ...@@ -14187,14 +14154,12 @@ dumpTSTemplate(Archive *fout, TSTemplateInfo *tmplinfo)
if (tmplinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (tmplinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, tmplinfo->dobj.catId, tmplinfo->dobj.dumpId, ArchiveEntry(fout, tmplinfo->dobj.catId, tmplinfo->dobj.dumpId,
tmplinfo->dobj.name, ARCHIVE_OPTS(.tag = tmplinfo->dobj.name,
tmplinfo->dobj.namespace->dobj.name, .namespace = tmplinfo->dobj.namespace->dobj.name,
NULL, .description = "TEXT SEARCH TEMPLATE",
"", .section = SECTION_PRE_DATA,
"TEXT SEARCH TEMPLATE", SECTION_PRE_DATA, .createStmt = q->data,
q->data, delq->data, NULL, .dropStmt = delq->data));
NULL, 0,
NULL, NULL);
/* Dump Template Comments */ /* Dump Template Comments */
if (tmplinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (tmplinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -14307,14 +14272,13 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo) ...@@ -14307,14 +14272,13 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo)
if (cfginfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (cfginfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, cfginfo->dobj.catId, cfginfo->dobj.dumpId, ArchiveEntry(fout, cfginfo->dobj.catId, cfginfo->dobj.dumpId,
cfginfo->dobj.name, ARCHIVE_OPTS(.tag = cfginfo->dobj.name,
cfginfo->dobj.namespace->dobj.name, .namespace = cfginfo->dobj.namespace->dobj.name,
NULL, .owner = cfginfo->rolname,
cfginfo->rolname, .description = "TEXT SEARCH CONFIGURATION",
"TEXT SEARCH CONFIGURATION", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Configuration Comments */ /* Dump Configuration Comments */
if (cfginfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (cfginfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -14373,14 +14337,12 @@ dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo) ...@@ -14373,14 +14337,12 @@ dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo)
if (fdwinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (fdwinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, fdwinfo->dobj.catId, fdwinfo->dobj.dumpId, ArchiveEntry(fout, fdwinfo->dobj.catId, fdwinfo->dobj.dumpId,
fdwinfo->dobj.name, ARCHIVE_OPTS(.tag = fdwinfo->dobj.name,
NULL, .owner = fdwinfo->rolname,
NULL, .description = "FOREIGN DATA WRAPPER",
fdwinfo->rolname, .section = SECTION_PRE_DATA,
"FOREIGN DATA WRAPPER", SECTION_PRE_DATA, .createStmt = q->data,
q->data, delq->data, NULL, .dropStmt = delq->data));
NULL, 0,
NULL, NULL);
/* Dump Foreign Data Wrapper Comments */ /* Dump Foreign Data Wrapper Comments */
if (fdwinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (fdwinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -14464,14 +14426,12 @@ dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo) ...@@ -14464,14 +14426,12 @@ dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo)
if (srvinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (srvinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, srvinfo->dobj.catId, srvinfo->dobj.dumpId, ArchiveEntry(fout, srvinfo->dobj.catId, srvinfo->dobj.dumpId,
srvinfo->dobj.name, ARCHIVE_OPTS(.tag = srvinfo->dobj.name,
NULL, .owner = srvinfo->rolname,
NULL, .description = "SERVER",
srvinfo->rolname, .section = SECTION_PRE_DATA,
"SERVER", SECTION_PRE_DATA, .createStmt = q->data,
q->data, delq->data, NULL, .dropStmt = delq->data));
NULL, 0,
NULL, NULL);
/* Dump Foreign Server Comments */ /* Dump Foreign Server Comments */
if (srvinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (srvinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -14582,14 +14542,13 @@ dumpUserMappings(Archive *fout, ...@@ -14582,14 +14542,13 @@ dumpUserMappings(Archive *fout,
usename, servername); usename, servername);
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
tag->data, ARCHIVE_OPTS(.tag = tag->data,
namespace, .namespace = namespace,
NULL, .owner = owner,
owner, .description = "USER MAPPING",
"USER MAPPING", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
&dumpId, 1, .dropStmt = delq->data));
NULL, NULL);
} }
PQclear(res); PQclear(res);
...@@ -14661,14 +14620,13 @@ dumpDefaultACL(Archive *fout, DefaultACLInfo *daclinfo) ...@@ -14661,14 +14620,13 @@ dumpDefaultACL(Archive *fout, DefaultACLInfo *daclinfo)
if (daclinfo->dobj.dump & DUMP_COMPONENT_ACL) if (daclinfo->dobj.dump & DUMP_COMPONENT_ACL)
ArchiveEntry(fout, daclinfo->dobj.catId, daclinfo->dobj.dumpId, ArchiveEntry(fout, daclinfo->dobj.catId, daclinfo->dobj.dumpId,
tag->data, ARCHIVE_OPTS(.tag = tag->data,
daclinfo->dobj.namespace ? daclinfo->dobj.namespace->dobj.name : NULL, .namespace = daclinfo->dobj.namespace ?
NULL, daclinfo->dobj.namespace->dobj.name : NULL,
daclinfo->defaclrole, .owner = daclinfo->defaclrole,
"DEFAULT ACL", SECTION_POST_DATA, .description = "DEFAULT ACL",
q->data, "", NULL, .section = SECTION_POST_DATA,
NULL, 0, .createStmt = q->data));
NULL, NULL);
destroyPQExpBuffer(tag); destroyPQExpBuffer(tag);
destroyPQExpBuffer(q); destroyPQExpBuffer(q);
...@@ -14760,13 +14718,14 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId, ...@@ -14760,13 +14718,14 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId,
appendPQExpBuffer(tag, "%s %s", type, name); appendPQExpBuffer(tag, "%s %s", type, name);
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
tag->data, nspname, ARCHIVE_OPTS(.tag = tag->data,
NULL, .namespace = nspname,
owner ? owner : "", .owner = owner,
"ACL", SECTION_NONE, .description = "ACL",
sql->data, "", NULL, .section = SECTION_NONE,
&(objDumpId), 1, .createStmt = sql->data,
NULL, NULL); .deps = &objDumpId,
.nDeps = 1));
destroyPQExpBuffer(tag); destroyPQExpBuffer(tag);
} }
...@@ -14848,11 +14807,14 @@ dumpSecLabel(Archive *fout, const char *type, const char *name, ...@@ -14848,11 +14807,14 @@ dumpSecLabel(Archive *fout, const char *type, const char *name,
appendPQExpBuffer(tag, "%s %s", type, name); appendPQExpBuffer(tag, "%s %s", type, name);
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
tag->data, namespace, NULL, owner, ARCHIVE_OPTS(.tag = tag->data,
"SECURITY LABEL", SECTION_NONE, .namespace = namespace,
query->data, "", NULL, .owner = owner,
&(dumpId), 1, .description = "SECURITY LABEL",
NULL, NULL); .section = SECTION_NONE,
.createStmt = query->data,
.deps = &dumpId,
.nDeps = 1));
destroyPQExpBuffer(tag); destroyPQExpBuffer(tag);
} }
...@@ -14928,13 +14890,14 @@ dumpTableSecLabel(Archive *fout, TableInfo *tbinfo, const char *reltypename) ...@@ -14928,13 +14890,14 @@ dumpTableSecLabel(Archive *fout, TableInfo *tbinfo, const char *reltypename)
appendPQExpBuffer(target, "%s %s", reltypename, appendPQExpBuffer(target, "%s %s", reltypename,
fmtId(tbinfo->dobj.name)); fmtId(tbinfo->dobj.name));
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
target->data, ARCHIVE_OPTS(.tag = target->data,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
NULL, tbinfo->rolname, .owner = tbinfo->rolname,
"SECURITY LABEL", SECTION_NONE, .description = "SECURITY LABEL",
query->data, "", NULL, .section = SECTION_NONE,
&(tbinfo->dobj.dumpId), 1, .createStmt = query->data,
NULL, NULL); .deps = &(tbinfo->dobj.dumpId),
.nDeps = 1));
} }
destroyPQExpBuffer(query); destroyPQExpBuffer(query);
destroyPQExpBuffer(target); destroyPQExpBuffer(target);
...@@ -16012,16 +15975,16 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) ...@@ -16012,16 +15975,16 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
if (tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, tbinfo->dobj.catId, tbinfo->dobj.dumpId, ArchiveEntry(fout, tbinfo->dobj.catId, tbinfo->dobj.dumpId,
tbinfo->dobj.name, ARCHIVE_OPTS(.tag = tbinfo->dobj.name,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
(tbinfo->relkind == RELKIND_VIEW) ? NULL : tbinfo->reltablespace, .tablespace = (tbinfo->relkind == RELKIND_VIEW) ?
tbinfo->rolname, NULL : tbinfo->reltablespace,
reltypename, .owner = tbinfo->rolname,
tbinfo->postponed_def ? .description = reltypename,
SECTION_POST_DATA : SECTION_PRE_DATA, .section = tbinfo->postponed_def ?
q->data, delq->data, NULL, SECTION_POST_DATA : SECTION_PRE_DATA,
NULL, 0, .createStmt = q->data,
NULL, NULL); .dropStmt = delq->data));
/* Dump Table Comments */ /* Dump Table Comments */
...@@ -16092,14 +16055,13 @@ dumpAttrDef(Archive *fout, AttrDefInfo *adinfo) ...@@ -16092,14 +16055,13 @@ dumpAttrDef(Archive *fout, AttrDefInfo *adinfo)
if (adinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (adinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, adinfo->dobj.catId, adinfo->dobj.dumpId, ArchiveEntry(fout, adinfo->dobj.catId, adinfo->dobj.dumpId,
tag, ARCHIVE_OPTS(.tag = tag,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
NULL, .owner = tbinfo->rolname,
tbinfo->rolname, .description = "DEFAULT",
"DEFAULT", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
free(tag); free(tag);
destroyPQExpBuffer(q); destroyPQExpBuffer(q);
...@@ -16241,14 +16203,14 @@ dumpIndex(Archive *fout, IndxInfo *indxinfo) ...@@ -16241,14 +16203,14 @@ dumpIndex(Archive *fout, IndxInfo *indxinfo)
if (indxinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (indxinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, indxinfo->dobj.catId, indxinfo->dobj.dumpId, ArchiveEntry(fout, indxinfo->dobj.catId, indxinfo->dobj.dumpId,
indxinfo->dobj.name, ARCHIVE_OPTS(.tag = indxinfo->dobj.name,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
indxinfo->tablespace, .tablespace = indxinfo->tablespace,
tbinfo->rolname, .owner = tbinfo->rolname,
"INDEX", SECTION_POST_DATA, .description = "INDEX",
q->data, delq->data, NULL, .section = SECTION_POST_DATA,
NULL, 0, .createStmt = q->data,
NULL, NULL); .dropStmt = delq->data));
if (indstatcolsarray) if (indstatcolsarray)
free(indstatcolsarray); free(indstatcolsarray);
...@@ -16290,14 +16252,11 @@ dumpIndexAttach(Archive *fout, IndexAttachInfo *attachinfo) ...@@ -16290,14 +16252,11 @@ dumpIndexAttach(Archive *fout, IndexAttachInfo *attachinfo)
fmtQualifiedDumpable(attachinfo->partitionIdx)); fmtQualifiedDumpable(attachinfo->partitionIdx));
ArchiveEntry(fout, attachinfo->dobj.catId, attachinfo->dobj.dumpId, ArchiveEntry(fout, attachinfo->dobj.catId, attachinfo->dobj.dumpId,
attachinfo->dobj.name, ARCHIVE_OPTS(.tag = attachinfo->dobj.name,
attachinfo->dobj.namespace->dobj.name, .namespace = attachinfo->dobj.namespace->dobj.name,
NULL, .description = "INDEX ATTACH",
"", .section = SECTION_POST_DATA,
"INDEX ATTACH", SECTION_POST_DATA, .createStmt = q->data));
q->data, "", NULL,
NULL, 0,
NULL, NULL);
destroyPQExpBuffer(q); destroyPQExpBuffer(q);
} }
...@@ -16345,14 +16304,13 @@ dumpStatisticsExt(Archive *fout, StatsExtInfo *statsextinfo) ...@@ -16345,14 +16304,13 @@ dumpStatisticsExt(Archive *fout, StatsExtInfo *statsextinfo)
if (statsextinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (statsextinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, statsextinfo->dobj.catId, ArchiveEntry(fout, statsextinfo->dobj.catId,
statsextinfo->dobj.dumpId, statsextinfo->dobj.dumpId,
statsextinfo->dobj.name, ARCHIVE_OPTS(.tag = statsextinfo->dobj.name,
statsextinfo->dobj.namespace->dobj.name, .namespace = statsextinfo->dobj.namespace->dobj.name,
NULL, .owner = statsextinfo->rolname,
statsextinfo->rolname, .description = "STATISTICS",
"STATISTICS", SECTION_POST_DATA, .section = SECTION_POST_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
/* Dump Statistics Comments */ /* Dump Statistics Comments */
if (statsextinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (statsextinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
...@@ -16506,14 +16464,14 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) ...@@ -16506,14 +16464,14 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo)
if (coninfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (coninfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, coninfo->dobj.catId, coninfo->dobj.dumpId, ArchiveEntry(fout, coninfo->dobj.catId, coninfo->dobj.dumpId,
tag, ARCHIVE_OPTS(.tag = tag,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
indxinfo->tablespace, .tablespace = indxinfo->tablespace,
tbinfo->rolname, .owner = tbinfo->rolname,
"CONSTRAINT", SECTION_POST_DATA, .description = "CONSTRAINT",
q->data, delq->data, NULL, .section = SECTION_POST_DATA,
NULL, 0, .createStmt = q->data,
NULL, NULL); .dropStmt = delq->data));
} }
else if (coninfo->contype == 'f') else if (coninfo->contype == 'f')
{ {
...@@ -16546,14 +16504,13 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) ...@@ -16546,14 +16504,13 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo)
if (coninfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (coninfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, coninfo->dobj.catId, coninfo->dobj.dumpId, ArchiveEntry(fout, coninfo->dobj.catId, coninfo->dobj.dumpId,
tag, ARCHIVE_OPTS(.tag = tag,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
NULL, .owner = tbinfo->rolname,
tbinfo->rolname, .description = "FK CONSTRAINT",
"FK CONSTRAINT", SECTION_POST_DATA, .section = SECTION_POST_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
} }
else if (coninfo->contype == 'c' && tbinfo) else if (coninfo->contype == 'c' && tbinfo)
{ {
...@@ -16578,14 +16535,13 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) ...@@ -16578,14 +16535,13 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo)
if (coninfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (coninfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, coninfo->dobj.catId, coninfo->dobj.dumpId, ArchiveEntry(fout, coninfo->dobj.catId, coninfo->dobj.dumpId,
tag, ARCHIVE_OPTS(.tag = tag,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
NULL, .owner = tbinfo->rolname,
tbinfo->rolname, .description = "CHECK CONSTRAINT",
"CHECK CONSTRAINT", SECTION_POST_DATA, .section = SECTION_POST_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
} }
} }
else if (coninfo->contype == 'c' && tbinfo == NULL) else if (coninfo->contype == 'c' && tbinfo == NULL)
...@@ -16611,14 +16567,13 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) ...@@ -16611,14 +16567,13 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo)
if (coninfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (coninfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, coninfo->dobj.catId, coninfo->dobj.dumpId, ArchiveEntry(fout, coninfo->dobj.catId, coninfo->dobj.dumpId,
tag, ARCHIVE_OPTS(.tag = tag,
tyinfo->dobj.namespace->dobj.name, .namespace = tyinfo->dobj.namespace->dobj.name,
NULL, .owner = tyinfo->rolname,
tyinfo->rolname, .description = "CHECK CONSTRAINT",
"CHECK CONSTRAINT", SECTION_POST_DATA, .section = SECTION_POST_DATA,
q->data, delq->data, NULL, .createStmt = q->data,
NULL, 0, .dropStmt = delq->data));
NULL, NULL);
} }
} }
else else
...@@ -16885,14 +16840,13 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) ...@@ -16885,14 +16840,13 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
if (tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, tbinfo->dobj.catId, tbinfo->dobj.dumpId, ArchiveEntry(fout, tbinfo->dobj.catId, tbinfo->dobj.dumpId,
tbinfo->dobj.name, ARCHIVE_OPTS(.tag = tbinfo->dobj.name,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
NULL, .owner = tbinfo->rolname,
tbinfo->rolname, .description = "SEQUENCE",
"SEQUENCE", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
query->data, delqry->data, NULL, .createStmt = query->data,
NULL, 0, .dropStmt = delqry->data));
NULL, NULL);
/* /*
* If the sequence is owned by a table column, emit the ALTER for it as a * If the sequence is owned by a table column, emit the ALTER for it as a
...@@ -16926,14 +16880,14 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) ...@@ -16926,14 +16880,14 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
if (tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
tbinfo->dobj.name, ARCHIVE_OPTS(.tag = tbinfo->dobj.name,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
NULL, .owner = tbinfo->rolname,
tbinfo->rolname, .description = "SEQUENCE OWNED BY",
"SEQUENCE OWNED BY", SECTION_PRE_DATA, .section = SECTION_PRE_DATA,
query->data, "", NULL, .createStmt = query->data,
&(tbinfo->dobj.dumpId), 1, .deps = &(tbinfo->dobj.dumpId),
NULL, NULL); .nDeps = 1));
} }
} }
...@@ -16994,14 +16948,14 @@ dumpSequenceData(Archive *fout, TableDataInfo *tdinfo) ...@@ -16994,14 +16948,14 @@ dumpSequenceData(Archive *fout, TableDataInfo *tdinfo)
if (tdinfo->dobj.dump & DUMP_COMPONENT_DATA) if (tdinfo->dobj.dump & DUMP_COMPONENT_DATA)
ArchiveEntry(fout, nilCatalogId, createDumpId(), ArchiveEntry(fout, nilCatalogId, createDumpId(),
tbinfo->dobj.name, ARCHIVE_OPTS(.tag = tbinfo->dobj.name,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
NULL, .owner = tbinfo->rolname,
tbinfo->rolname, .description = "SEQUENCE SET",
"SEQUENCE SET", SECTION_DATA, .section = SECTION_DATA,
query->data, "", NULL, .createStmt = query->data,
&(tbinfo->dobj.dumpId), 1, .deps = &(tbinfo->dobj.dumpId),
NULL, NULL); .nDeps = 1));
PQclear(res); PQclear(res);
...@@ -17193,14 +17147,13 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo) ...@@ -17193,14 +17147,13 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo)
if (tginfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (tginfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, tginfo->dobj.catId, tginfo->dobj.dumpId, ArchiveEntry(fout, tginfo->dobj.catId, tginfo->dobj.dumpId,
tag, ARCHIVE_OPTS(.tag = tag,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
NULL, .owner = tbinfo->rolname,
tbinfo->rolname, .description = "TRIGGER",
"TRIGGER", SECTION_POST_DATA, .section = SECTION_POST_DATA,
query->data, delqry->data, NULL, .createStmt = query->data,
NULL, 0, .dropStmt = delqry->data));
NULL, NULL);
if (tginfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (tginfo->dobj.dump & DUMP_COMPONENT_COMMENT)
dumpComment(fout, trigprefix->data, qtabname, dumpComment(fout, trigprefix->data, qtabname,
...@@ -17282,12 +17235,12 @@ dumpEventTrigger(Archive *fout, EventTriggerInfo *evtinfo) ...@@ -17282,12 +17235,12 @@ dumpEventTrigger(Archive *fout, EventTriggerInfo *evtinfo)
if (evtinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (evtinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, evtinfo->dobj.catId, evtinfo->dobj.dumpId, ArchiveEntry(fout, evtinfo->dobj.catId, evtinfo->dobj.dumpId,
evtinfo->dobj.name, NULL, NULL, ARCHIVE_OPTS(.tag = evtinfo->dobj.name,
evtinfo->evtowner, .owner = evtinfo->evtowner,
"EVENT TRIGGER", SECTION_POST_DATA, .description = "EVENT TRIGGER",
query->data, delqry->data, NULL, .section = SECTION_POST_DATA,
NULL, 0, .createStmt = query->data,
NULL, NULL); .dropStmt = delqry->data));
if (evtinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (evtinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
dumpComment(fout, "EVENT TRIGGER", qevtname, dumpComment(fout, "EVENT TRIGGER", qevtname,
...@@ -17440,14 +17393,13 @@ dumpRule(Archive *fout, RuleInfo *rinfo) ...@@ -17440,14 +17393,13 @@ dumpRule(Archive *fout, RuleInfo *rinfo)
if (rinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) if (rinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)
ArchiveEntry(fout, rinfo->dobj.catId, rinfo->dobj.dumpId, ArchiveEntry(fout, rinfo->dobj.catId, rinfo->dobj.dumpId,
tag, ARCHIVE_OPTS(.tag = tag,
tbinfo->dobj.namespace->dobj.name, .namespace = tbinfo->dobj.namespace->dobj.name,
NULL, .owner = tbinfo->rolname,
tbinfo->rolname, .description = "RULE",
"RULE", SECTION_POST_DATA, .section = SECTION_POST_DATA,
cmd->data, delcmd->data, NULL, .createStmt = cmd->data,
NULL, 0, .dropStmt = delcmd->data));
NULL, NULL);
/* Dump rule comments */ /* Dump rule comments */
if (rinfo->dobj.dump & DUMP_COMPONENT_COMMENT) if (rinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment