NULL, /* Dumper */
NULL); /* Dumper Arg */
+ /* Compute correct tag for comments etc */
+ appendPQExpBuffer(labelq, "DATABASE %s", fmtId(datname));
+
+ /* Dump DB comment if any */
+ if (fout->remoteVersion >= 80200)
+ {
+ /*
+ * 8.2 and up keep comments on shared objects in a shared table, so we
+ * cannot use the dumpComment() code used for other database objects.
+ * Be careful that the ArchiveEntry parameters match that function.
+ */
+ char *comment = PQgetvalue(res, 0, PQfnumber(res, "description"));
+
+ if (comment && *comment)
+ {
+ resetPQExpBuffer(dbQry);
+
+ /*
+ * Generates warning when loaded into a differently-named
+ * database.
+ */
+ appendPQExpBuffer(dbQry, "COMMENT ON DATABASE %s IS ", fmtId(datname));
+ appendStringLiteralAH(dbQry, comment, fout);
+ appendPQExpBufferStr(dbQry, ";\n");
+
+ ArchiveEntry(fout, nilCatalogId, createDumpId(),
+ labelq->data, NULL, NULL, dba,
+ false, "COMMENT", SECTION_NONE,
+ dbQry->data, "", NULL,
+ &(dbDumpId), 1,
+ NULL, NULL);
+ }
+ }
+ else
+ {
+ dumpComment(fout, labelq->data, NULL, dba,
+ dbCatId, 0, dbDumpId);
+ }
+
+ /* Dump shared security label. */
+ if (!dopt->no_security_labels && fout->remoteVersion >= 90200)
+ {
+ PGresult *shres;
+ PQExpBuffer seclabelQry;
+
+ seclabelQry = createPQExpBuffer();
+
+ buildShSecLabelQuery(conn, "pg_database", dbCatId.oid, seclabelQry);
+ shres = ExecuteSqlQuery(fout, seclabelQry->data, PGRES_TUPLES_OK);
+ resetPQExpBuffer(seclabelQry);
+ emitShSecLabels(conn, shres, seclabelQry, "DATABASE", datname);
+ if (seclabelQry->len > 0)
+ ArchiveEntry(fout, nilCatalogId, createDumpId(),
+ labelq->data, NULL, NULL, dba,
+ false, "SECURITY LABEL", SECTION_NONE,
+ seclabelQry->data, "", NULL,
+ &(dbDumpId), 1,
+ NULL, NULL);
+ destroyPQExpBuffer(seclabelQry);
+ PQclear(shres);
+ }
+
/*
* pg_largeobject and pg_largeobject_metadata come from the old system
* intact, so set their relfrozenxids and relminmxids.
destroyPQExpBuffer(loOutQry);
}
- /* Compute correct tag for comments etc */
- appendPQExpBuffer(labelq, "DATABASE %s", fmtId(datname));
-
- /* Dump DB comment if any */
- if (fout->remoteVersion >= 80200)
- {
- /*
- * 8.2 and up keep comments on shared objects in a shared table, so we
- * cannot use the dumpComment() code used for other database objects.
- * Be careful that the ArchiveEntry parameters match that function.
- */
- char *comment = PQgetvalue(res, 0, PQfnumber(res, "description"));
-
- if (comment && *comment)
- {
- resetPQExpBuffer(dbQry);
-
- /*
- * Generates warning when loaded into a differently-named
- * database.
- */
- appendPQExpBuffer(dbQry, "COMMENT ON DATABASE %s IS ", fmtId(datname));
- appendStringLiteralAH(dbQry, comment, fout);
- appendPQExpBufferStr(dbQry, ";\n");
-
- ArchiveEntry(fout, nilCatalogId, createDumpId(),
- labelq->data, NULL, NULL, dba,
- false, "COMMENT", SECTION_NONE,
- dbQry->data, "", NULL,
- &(dbDumpId), 1,
- NULL, NULL);
- }
- }
- else
- {
- dumpComment(fout, labelq->data, NULL, dba,
- dbCatId, 0, dbDumpId);
- }
-
- /* Dump shared security label. */
- if (!dopt->no_security_labels && fout->remoteVersion >= 90200)
- {
- PGresult *shres;
- PQExpBuffer seclabelQry;
-
- seclabelQry = createPQExpBuffer();
-
- buildShSecLabelQuery(conn, "pg_database", dbCatId.oid, seclabelQry);
- shres = ExecuteSqlQuery(fout, seclabelQry->data, PGRES_TUPLES_OK);
- resetPQExpBuffer(seclabelQry);
- emitShSecLabels(conn, shres, seclabelQry, "DATABASE", datname);
- if (seclabelQry->len > 0)
- ArchiveEntry(fout, nilCatalogId, createDumpId(),
- labelq->data, NULL, NULL, dba,
- false, "SECURITY LABEL", SECTION_NONE,
- seclabelQry->data, "", NULL,
- &(dbDumpId), 1,
- NULL, NULL);
- destroyPQExpBuffer(seclabelQry);
- PQclear(shres);
- }
-
PQclear(res);
destroyPQExpBuffer(dbQry);
NULL, 0,
NULL, NULL);
+ /* Dump Foreign Data Wrapper Comments */
+ if (fdwinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
+ dumpComment(fout, labelq->data,
+ NULL, fdwinfo->rolname,
+ fdwinfo->dobj.catId, 0, fdwinfo->dobj.dumpId);
+
/* Handle the ACL */
if (fdwinfo->dobj.dump & DUMP_COMPONENT_ACL)
dumpACL(fout, fdwinfo->dobj.catId, fdwinfo->dobj.dumpId,
fdwinfo->fdwacl, fdwinfo->rfdwacl,
fdwinfo->initfdwacl, fdwinfo->initrfdwacl);
- /* Dump Foreign Data Wrapper Comments */
- if (fdwinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
- dumpComment(fout, labelq->data,
- NULL, fdwinfo->rolname,
- fdwinfo->dobj.catId, 0, fdwinfo->dobj.dumpId);
-
free(qfdwname);
destroyPQExpBuffer(q);
NULL, 0,
NULL, NULL);
+ /* Dump Foreign Server Comments */
+ if (srvinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
+ dumpComment(fout, labelq->data,
+ NULL, srvinfo->rolname,
+ srvinfo->dobj.catId, 0, srvinfo->dobj.dumpId);
+
/* Handle the ACL */
if (srvinfo->dobj.dump & DUMP_COMPONENT_ACL)
dumpACL(fout, srvinfo->dobj.catId, srvinfo->dobj.dumpId,
srvinfo->rolname,
srvinfo->dobj.catId, srvinfo->dobj.dumpId);
- /* Dump Foreign Server Comments */
- if (srvinfo->dobj.dump & DUMP_COMPONENT_COMMENT)
- dumpComment(fout, labelq->data,
- NULL, srvinfo->rolname,
- srvinfo->dobj.catId, 0, srvinfo->dobj.dumpId);
-
free(qsrvname);
destroyPQExpBuffer(q);
if (attachinfo->partitionIdx->dobj.dump & DUMP_COMPONENT_DEFINITION)
{
- PQExpBuffer q = createPQExpBuffer();
+ PQExpBuffer q = createPQExpBuffer();
appendPQExpBuffer(q, "\nALTER INDEX %s ",
fmtQualifiedId(fout->remoteVersion,