diff options
Diffstat (limited to 'src/bin/pg_dump/pg_dump.c')
-rw-r--r-- | src/bin/pg_dump/pg_dump.c | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 1cd25adb6cf..806fc78f048 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -1205,7 +1205,7 @@ setup_connection(Archive *AH, const char *dumpencoding, { PQExpBuffer query = createPQExpBuffer(); - appendPQExpBuffer(query, "SET TRANSACTION SNAPSHOT "); + appendPQExpBufferStr(query, "SET TRANSACTION SNAPSHOT "); appendStringLiteralConn(query, AH->sync_snapshot_id, conn); ExecuteSqlStatement(AH, query->data); destroyPQExpBuffer(query); @@ -1315,8 +1315,8 @@ expand_schema_name_patterns(Archive *fout, for (cell = patterns->head; cell; cell = cell->next) { - appendPQExpBuffer(query, - "SELECT oid FROM pg_catalog.pg_namespace n\n"); + appendPQExpBufferStr(query, + "SELECT oid FROM pg_catalog.pg_namespace n\n"); processSQLNamePattern(GetConnection(fout), query, cell->val, false, false, NULL, "n.nspname", NULL, NULL); @@ -3733,7 +3733,7 @@ dumpPolicy(Archive *fout, PolicyInfo *polinfo) if (polinfo->polwithcheck != NULL) appendPQExpBuffer(query, " WITH CHECK (%s)", polinfo->polwithcheck); - appendPQExpBuffer(query, ";\n"); + appendPQExpBufferStr(query, ";\n"); appendPQExpBuffer(delqry, "DROP POLICY %s", fmtId(polinfo->polname)); appendPQExpBuffer(delqry, " ON %s;\n", fmtQualifiedDumpable(tbinfo)); @@ -4560,7 +4560,7 @@ getNamespaces(Archive *fout, int *numNamespaces) init_acl_subquery->data, init_racl_subquery->data); - appendPQExpBuffer(query, ") "); + appendPQExpBufferStr(query, ") "); destroyPQExpBuffer(acl_subquery); destroyPQExpBuffer(racl_subquery); @@ -5248,9 +5248,9 @@ getAccessMethods(Archive *fout, int *numAccessMethods) query = createPQExpBuffer(); /* Select all access methods from pg_am table */ - appendPQExpBuffer(query, "SELECT tableoid, oid, amname, amtype, " - "amhandler::pg_catalog.regproc AS amhandler " - "FROM pg_am"); + appendPQExpBufferStr(query, "SELECT tableoid, oid, amname, amtype, " + "amhandler::pg_catalog.regproc AS amhandler " + "FROM pg_am"); res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); @@ -8128,10 +8128,10 @@ getTransforms(Archive *fout, int *numTransforms) query = createPQExpBuffer(); - appendPQExpBuffer(query, "SELECT tableoid, oid, " - "trftype, trflang, trffromsql::oid, trftosql::oid " - "FROM pg_transform " - "ORDER BY 3,4"); + appendPQExpBufferStr(query, "SELECT tableoid, oid, " + "trftype, trflang, trffromsql::oid, trftosql::oid " + "FROM pg_transform " + "ORDER BY 3,4"); res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); @@ -8255,55 +8255,55 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) resetPQExpBuffer(q); - appendPQExpBuffer(q, - "SELECT\n" - "a.attnum,\n" - "a.attname,\n" - "a.atttypmod,\n" - "a.attstattarget,\n" - "a.attstorage,\n" - "t.typstorage,\n" - "a.attnotnull,\n" - "a.atthasdef,\n" - "a.attisdropped,\n" - "a.attlen,\n" - "a.attalign,\n" - "a.attislocal,\n" - "pg_catalog.format_type(t.oid, a.atttypmod) AS atttypname,\n"); + appendPQExpBufferStr(q, + "SELECT\n" + "a.attnum,\n" + "a.attname,\n" + "a.atttypmod,\n" + "a.attstattarget,\n" + "a.attstorage,\n" + "t.typstorage,\n" + "a.attnotnull,\n" + "a.atthasdef,\n" + "a.attisdropped,\n" + "a.attlen,\n" + "a.attalign,\n" + "a.attislocal,\n" + "pg_catalog.format_type(t.oid, a.atttypmod) AS atttypname,\n"); if (fout->remoteVersion >= 120000) - appendPQExpBuffer(q, - "a.attgenerated,\n"); + appendPQExpBufferStr(q, + "a.attgenerated,\n"); else - appendPQExpBuffer(q, - "'' AS attgenerated,\n"); + appendPQExpBufferStr(q, + "'' AS attgenerated,\n"); if (fout->remoteVersion >= 110000) - appendPQExpBuffer(q, - "CASE WHEN a.atthasmissing AND NOT a.attisdropped " - "THEN a.attmissingval ELSE null END AS attmissingval,\n"); + appendPQExpBufferStr(q, + "CASE WHEN a.atthasmissing AND NOT a.attisdropped " + "THEN a.attmissingval ELSE null END AS attmissingval,\n"); else - appendPQExpBuffer(q, - "NULL AS attmissingval,\n"); + appendPQExpBufferStr(q, + "NULL AS attmissingval,\n"); if (fout->remoteVersion >= 100000) - appendPQExpBuffer(q, - "a.attidentity,\n"); + appendPQExpBufferStr(q, + "a.attidentity,\n"); else - appendPQExpBuffer(q, - "'' AS attidentity,\n"); + appendPQExpBufferStr(q, + "'' AS attidentity,\n"); if (fout->remoteVersion >= 90200) - appendPQExpBuffer(q, - "pg_catalog.array_to_string(ARRAY(" - "SELECT pg_catalog.quote_ident(option_name) || " - "' ' || pg_catalog.quote_literal(option_value) " - "FROM pg_catalog.pg_options_to_table(attfdwoptions) " - "ORDER BY option_name" - "), E',\n ') AS attfdwoptions,\n"); + appendPQExpBufferStr(q, + "pg_catalog.array_to_string(ARRAY(" + "SELECT pg_catalog.quote_ident(option_name) || " + "' ' || pg_catalog.quote_literal(option_value) " + "FROM pg_catalog.pg_options_to_table(attfdwoptions) " + "ORDER BY option_name" + "), E',\n ') AS attfdwoptions,\n"); else - appendPQExpBuffer(q, - "'' AS attfdwoptions,\n"); + appendPQExpBufferStr(q, + "'' AS attfdwoptions,\n"); if (fout->remoteVersion >= 90100) { @@ -8312,20 +8312,20 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) * collation is different from their type's default, we use a CASE * here to suppress uninteresting attcollations cheaply. */ - appendPQExpBuffer(q, - "CASE WHEN a.attcollation <> t.typcollation " - "THEN a.attcollation ELSE 0 END AS attcollation,\n"); + appendPQExpBufferStr(q, + "CASE WHEN a.attcollation <> t.typcollation " + "THEN a.attcollation ELSE 0 END AS attcollation,\n"); } else - appendPQExpBuffer(q, - "0 AS attcollation,\n"); + appendPQExpBufferStr(q, + "0 AS attcollation,\n"); if (fout->remoteVersion >= 90000) - appendPQExpBuffer(q, - "array_to_string(a.attoptions, ', ') AS attoptions\n"); + appendPQExpBufferStr(q, + "array_to_string(a.attoptions, ', ') AS attoptions\n"); else - appendPQExpBuffer(q, - "'' AS attoptions\n"); + appendPQExpBufferStr(q, + "'' AS attoptions\n"); /* need left join here to not fail on dropped columns ... */ appendPQExpBuffer(q, @@ -12331,7 +12331,7 @@ dumpTransform(Archive *fout, TransformInfo *transform) if (transform->trftosql) { if (transform->trffromsql) - appendPQExpBuffer(defqry, ", "); + appendPQExpBufferStr(defqry, ", "); if (tosqlFuncInfo) { @@ -12349,7 +12349,7 @@ dumpTransform(Archive *fout, TransformInfo *transform) pg_log_warning("bogus value in pg_transform.trftosql field"); } - appendPQExpBuffer(defqry, ");\n"); + appendPQExpBufferStr(defqry, ");\n"); appendPQExpBuffer(labelq, "TRANSFORM FOR %s LANGUAGE %s", transformType, lanname); @@ -12724,10 +12724,10 @@ dumpAccessMethod(Archive *fout, AccessMethodInfo *aminfo) switch (aminfo->amtype) { case AMTYPE_INDEX: - appendPQExpBuffer(q, "TYPE INDEX "); + appendPQExpBufferStr(q, "TYPE INDEX "); break; case AMTYPE_TABLE: - appendPQExpBuffer(q, "TYPE TABLE "); + appendPQExpBufferStr(q, "TYPE TABLE "); break; default: pg_log_warning("invalid type \"%c\" of access method \"%s\"", @@ -13433,23 +13433,23 @@ dumpCollation(Archive *fout, CollInfo *collinfo) qcollname = pg_strdup(fmtId(collinfo->dobj.name)); /* Get collation-specific details */ - appendPQExpBuffer(query, "SELECT "); + appendPQExpBufferStr(query, "SELECT "); if (fout->remoteVersion >= 100000) - appendPQExpBuffer(query, - "collprovider, " - "collversion, "); + appendPQExpBufferStr(query, + "collprovider, " + "collversion, "); else - appendPQExpBuffer(query, - "'c' AS collprovider, " - "NULL AS collversion, "); + appendPQExpBufferStr(query, + "'c' AS collprovider, " + "NULL AS collversion, "); if (fout->remoteVersion >= 120000) - appendPQExpBuffer(query, - "collisdeterministic, "); + appendPQExpBufferStr(query, + "collisdeterministic, "); else - appendPQExpBuffer(query, - "true AS collisdeterministic, "); + appendPQExpBufferStr(query, + "true AS collisdeterministic, "); appendPQExpBuffer(query, "collcollate, " @@ -13665,7 +13665,7 @@ format_aggregate_signature(AggInfo *agginfo, Archive *fout, bool honor_quotes) appendPQExpBufferStr(&buf, agginfo->aggfn.dobj.name); if (agginfo->aggfn.nargs == 0) - appendPQExpBuffer(&buf, "(*)"); + appendPQExpBufferStr(&buf, "(*)"); else { appendPQExpBufferChar(&buf, '('); @@ -14883,13 +14883,13 @@ dumpACL(Archive *fout, CatalogId objCatId, DumpId objDumpId, */ if (strlen(initacls) != 0 || strlen(initracls) != 0) { - appendPQExpBuffer(sql, "SELECT pg_catalog.binary_upgrade_set_record_init_privs(true);\n"); + appendPQExpBufferStr(sql, "SELECT pg_catalog.binary_upgrade_set_record_init_privs(true);\n"); if (!buildACLCommands(name, subname, nspname, type, initacls, initracls, owner, "", fout->remoteVersion, sql)) fatal("could not parse initial GRANT ACL list (%s) or initial REVOKE ACL list (%s) for object \"%s\" (%s)", initacls, initracls, name, type); - appendPQExpBuffer(sql, "SELECT pg_catalog.binary_upgrade_set_record_init_privs(false);\n"); + appendPQExpBufferStr(sql, "SELECT pg_catalog.binary_upgrade_set_record_init_privs(false);\n"); } if (!buildACLCommands(name, subname, nspname, type, @@ -16591,7 +16591,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) } if (indxinfo->indnkeyattrs < indxinfo->indnattrs) - appendPQExpBuffer(q, ") INCLUDE ("); + appendPQExpBufferStr(q, ") INCLUDE ("); for (k = indxinfo->indnkeyattrs; k < indxinfo->indnattrs; k++) { @@ -16988,9 +16988,9 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) "ALTER COLUMN %s ADD GENERATED ", fmtId(owning_tab->attnames[tbinfo->owning_col - 1])); if (owning_tab->attidentity[tbinfo->owning_col - 1] == ATTRIBUTE_IDENTITY_ALWAYS) - appendPQExpBuffer(query, "ALWAYS"); + appendPQExpBufferStr(query, "ALWAYS"); else if (owning_tab->attidentity[tbinfo->owning_col - 1] == ATTRIBUTE_IDENTITY_BY_DEFAULT) - appendPQExpBuffer(query, "BY DEFAULT"); + appendPQExpBufferStr(query, "BY DEFAULT"); appendPQExpBuffer(query, " AS IDENTITY (\n SEQUENCE NAME %s\n", fmtQualifiedDumpable(tbinfo)); } |