]> granicus.if.org Git - postgresql/commitdiff
Replace appendPQExpBuffer(..., <constant>) with appendPQExpBufferStr
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 18 Nov 2013 16:29:01 +0000 (18:29 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 18 Nov 2013 16:34:51 +0000 (18:34 +0200)
Arguably makes the code a bit more readable, and might give a small
performance gain.

David Rowley

15 files changed:
src/bin/pg_dump/dumputils.c
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dumpall.c
src/bin/psql/command.c
src/bin/psql/copy.c
src/bin/psql/describe.c
src/bin/psql/tab-complete.c
src/bin/scripts/clusterdb.c
src/bin/scripts/createdb.c
src/bin/scripts/createuser.c
src/bin/scripts/reindexdb.c
src/bin/scripts/vacuumdb.c
src/interfaces/libpq/fe-connect.c
src/test/isolation/isolationtester.c

index 9c55147c816104210757e09910923b1077b070bf..d6184e31b505129b9a06b1e711cf19aec5abc18a 100644 (file)
@@ -168,11 +168,11 @@ fmtQualifiedId(int remoteVersion, const char *schema, const char *id)
        {
                appendPQExpBuffer(lcl_pqexp, "%s.", fmtId(schema));
        }
-       appendPQExpBuffer(lcl_pqexp, "%s", fmtId(id));
+       appendPQExpBufferStr(lcl_pqexp, fmtId(id));
 
        id_return = getLocalPQExpBuffer();
 
-       appendPQExpBuffer(id_return, "%s", lcl_pqexp->data);
+       appendPQExpBufferStr(id_return, lcl_pqexp->data);
        destroyPQExpBuffer(lcl_pqexp);
 
        return id_return->data;
@@ -625,7 +625,7 @@ buildACLCommands(const char *name, const char *subname,
                                        appendPQExpBuffer(secondsql, "%sGRANT %s ON %s %s TO ",
                                                                          prefix, privs->data, type, name);
                                        if (grantee->len == 0)
-                                               appendPQExpBuffer(secondsql, "PUBLIC;\n");
+                                               appendPQExpBufferStr(secondsql, "PUBLIC;\n");
                                        else if (strncmp(grantee->data, "group ",
                                                                         strlen("group ")) == 0)
                                                appendPQExpBuffer(secondsql, "GROUP %s;\n",
@@ -638,19 +638,19 @@ buildACLCommands(const char *name, const char *subname,
                                        appendPQExpBuffer(secondsql, "%sGRANT %s ON %s %s TO ",
                                                                          prefix, privswgo->data, type, name);
                                        if (grantee->len == 0)
-                                               appendPQExpBuffer(secondsql, "PUBLIC");
+                                               appendPQExpBufferStr(secondsql, "PUBLIC");
                                        else if (strncmp(grantee->data, "group ",
                                                                         strlen("group ")) == 0)
                                                appendPQExpBuffer(secondsql, "GROUP %s",
                                                                        fmtId(grantee->data + strlen("group ")));
                                        else
-                                               appendPQExpBuffer(secondsql, "%s", fmtId(grantee->data));
-                                       appendPQExpBuffer(secondsql, " WITH GRANT OPTION;\n");
+                                               appendPQExpBufferStr(secondsql, fmtId(grantee->data));
+                                       appendPQExpBufferStr(secondsql, " WITH GRANT OPTION;\n");
                                }
 
                                if (grantor->len > 0
                                        && (!owner || strcmp(owner, grantor->data) != 0))
-                                       appendPQExpBuffer(secondsql, "RESET SESSION AUTHORIZATION;\n");
+                                       appendPQExpBufferStr(secondsql, "RESET SESSION AUTHORIZATION;\n");
                        }
                }
        }
@@ -947,7 +947,7 @@ AddAcl(PQExpBuffer aclbuf, const char *keyword, const char *subname)
 {
        if (aclbuf->len > 0)
                appendPQExpBufferChar(aclbuf, ',');
-       appendPQExpBuffer(aclbuf, "%s", keyword);
+       appendPQExpBufferStr(aclbuf, keyword);
        if (subname)
                appendPQExpBuffer(aclbuf, "(%s)", subname);
 }
@@ -1205,7 +1205,7 @@ emitShSecLabels(PGconn *conn, PGresult *res, PQExpBuffer buffer,
                                                  " %s IS ",
                                                  fmtId(objname));
                appendStringLiteralConn(buffer, label, conn);
-               appendPQExpBuffer(buffer, ";\n");
+               appendPQExpBufferStr(buffer, ";\n");
        }
 }
 
index 1e189fe8adfdfe2a10fd1b92882c9536d2d83b97..63a800938aef8ac51be010550b3542d1ee630a09 100644 (file)
@@ -2619,7 +2619,7 @@ _doSetSessionAuth(ArchiveHandle *AH, const char *user)
 {
        PQExpBuffer cmd = createPQExpBuffer();
 
-       appendPQExpBuffer(cmd, "SET SESSION AUTHORIZATION ");
+       appendPQExpBufferStr(cmd, "SET SESSION AUTHORIZATION ");
 
        /*
         * SQL requires a string literal here.  Might as well be correct.
@@ -2627,8 +2627,8 @@ _doSetSessionAuth(ArchiveHandle *AH, const char *user)
        if (user && *user)
                appendStringLiteralAHX(cmd, user, AH);
        else
-               appendPQExpBuffer(cmd, "DEFAULT");
-       appendPQExpBuffer(cmd, ";");
+               appendPQExpBufferStr(cmd, "DEFAULT");
+       appendPQExpBufferChar(cmd, ';');
 
        if (RestoringToDB(AH))
        {
@@ -2798,7 +2798,7 @@ _selectOutputSchema(ArchiveHandle *AH, const char *schemaName)
        appendPQExpBuffer(qry, "SET search_path = %s",
                                          fmtId(schemaName));
        if (strcmp(schemaName, "pg_catalog") != 0)
-               appendPQExpBuffer(qry, ", pg_catalog");
+               appendPQExpBufferStr(qry, ", pg_catalog");
 
        if (RestoringToDB(AH))
        {
@@ -2853,7 +2853,7 @@ _selectTablespace(ArchiveHandle *AH, const char *tablespace)
        if (strcmp(want, "") == 0)
        {
                /* We want the tablespace to be the database's default */
-               appendPQExpBuffer(qry, "SET default_tablespace = ''");
+               appendPQExpBufferStr(qry, "SET default_tablespace = ''");
        }
        else
        {
@@ -3119,7 +3119,7 @@ _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isDat
                {
                        PQExpBuffer temp = createPQExpBuffer();
 
-                       appendPQExpBuffer(temp, "ALTER ");
+                       appendPQExpBufferStr(temp, "ALTER ");
                        _getObjectDescription(temp, te, AH);
                        appendPQExpBuffer(temp, " OWNER TO %s;", fmtId(te->owner));
                        ahprintf(AH, "%s\n\n", temp->data);
index f81094ee7055796916ef81fd77ae93c85383676e..a611940690db77fe6ae422375ebe0f44e6b2d492 100644 (file)
@@ -1033,7 +1033,7 @@ setup_connection(Archive *AH, const char *dumpencoding, char *use_role)
                {
                        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);
@@ -1127,7 +1127,7 @@ expand_schema_name_patterns(Archive *fout,
        for (cell = patterns->head; cell; cell = cell->next)
        {
                if (cell != patterns->head)
-                       appendPQExpBuffer(query, "UNION ALL\n");
+                       appendPQExpBufferStr(query, "UNION ALL\n");
                appendPQExpBuffer(query,
                                                  "SELECT oid FROM pg_catalog.pg_namespace n\n");
                processSQLNamePattern(GetConnection(fout), query, cell->val, false,
@@ -1171,7 +1171,7 @@ expand_table_name_patterns(Archive *fout,
        for (cell = patterns->head; cell; cell = cell->next)
        {
                if (cell != patterns->head)
-                       appendPQExpBuffer(query, "UNION ALL\n");
+                       appendPQExpBufferStr(query, "UNION ALL\n");
                appendPQExpBuffer(query,
                                                  "SELECT c.oid"
                                                  "\nFROM pg_catalog.pg_class c"
@@ -1920,7 +1920,7 @@ buildMatViewRefreshDependencies(Archive *fout)
 
        query = createPQExpBuffer();
 
-       appendPQExpBuffer(query, "with recursive w as "
+       appendPQExpBufferStr(query, "with recursive w as "
                                          "( "
                                        "select d1.objid, d2.refobjid, c2.relkind as refrelkind "
                                          "from pg_depend d1 "
@@ -2260,33 +2260,33 @@ dumpDatabase(Archive *fout)
                                          fmtId(datname));
        if (strlen(encoding) > 0)
        {
-               appendPQExpBuffer(creaQry, " ENCODING = ");
+               appendPQExpBufferStr(creaQry, " ENCODING = ");
                appendStringLiteralAH(creaQry, encoding, fout);
        }
        if (strlen(collate) > 0)
        {
-               appendPQExpBuffer(creaQry, " LC_COLLATE = ");
+               appendPQExpBufferStr(creaQry, " LC_COLLATE = ");
                appendStringLiteralAH(creaQry, collate, fout);
        }
        if (strlen(ctype) > 0)
        {
-               appendPQExpBuffer(creaQry, " LC_CTYPE = ");
+               appendPQExpBufferStr(creaQry, " LC_CTYPE = ");
                appendStringLiteralAH(creaQry, ctype, fout);
        }
        if (strlen(tablespace) > 0 && strcmp(tablespace, "pg_default") != 0)
                appendPQExpBuffer(creaQry, " TABLESPACE = %s",
                                                  fmtId(tablespace));
-       appendPQExpBuffer(creaQry, ";\n");
+       appendPQExpBufferStr(creaQry, ";\n");
 
        if (binary_upgrade)
        {
-               appendPQExpBuffer(creaQry, "\n-- For binary upgrade, set datfrozenxid.\n");
+               appendPQExpBufferStr(creaQry, "\n-- For binary upgrade, set datfrozenxid.\n");
                appendPQExpBuffer(creaQry, "UPDATE pg_catalog.pg_database\n"
                                                  "SET datfrozenxid = '%u'\n"
                                                  "WHERE        datname = ",
                                                  frozenxid);
                appendStringLiteralAH(creaQry, datname, fout);
-               appendPQExpBuffer(creaQry, ";\n");
+               appendPQExpBufferStr(creaQry, ";\n");
 
        }
 
@@ -2336,7 +2336,7 @@ dumpDatabase(Archive *fout)
 
                i_relfrozenxid = PQfnumber(lo_res, "relfrozenxid");
 
-               appendPQExpBuffer(loOutQry, "\n-- For binary upgrade, set pg_largeobject.relfrozenxid\n");
+               appendPQExpBufferStr(loOutQry, "\n-- For binary upgrade, set pg_largeobject.relfrozenxid\n");
                appendPQExpBuffer(loOutQry, "UPDATE pg_catalog.pg_class\n"
                                                  "SET relfrozenxid = '%u'\n"
                                                  "WHERE oid = %u;\n",
@@ -2368,7 +2368,7 @@ dumpDatabase(Archive *fout)
 
                        i_relfrozenxid = PQfnumber(lo_res, "relfrozenxid");
 
-                       appendPQExpBuffer(loOutQry, "\n-- For binary upgrade, set pg_largeobject_metadata.relfrozenxid\n");
+                       appendPQExpBufferStr(loOutQry, "\n-- For binary upgrade, set pg_largeobject_metadata.relfrozenxid\n");
                        appendPQExpBuffer(loOutQry, "UPDATE pg_catalog.pg_class\n"
                                                          "SET relfrozenxid = '%u'\n"
                                                          "WHERE oid = %u;\n",
@@ -2407,7 +2407,7 @@ dumpDatabase(Archive *fout)
                         */
                        appendPQExpBuffer(dbQry, "COMMENT ON DATABASE %s IS ", fmtId(datname));
                        appendStringLiteralAH(dbQry, comment, fout);
-                       appendPQExpBuffer(dbQry, ";\n");
+                       appendPQExpBufferStr(dbQry, ";\n");
 
                        ArchiveEntry(fout, dbCatId, createDumpId(), datname, NULL, NULL,
                                                 dba, false, "COMMENT", SECTION_NONE,
@@ -2460,9 +2460,9 @@ dumpEncoding(Archive *AH)
        if (g_verbose)
                write_msg(NULL, "saving encoding = %s\n", encname);
 
-       appendPQExpBuffer(qry, "SET client_encoding = ");
+       appendPQExpBufferStr(qry, "SET client_encoding = ");
        appendStringLiteralAH(qry, encname, AH);
-       appendPQExpBuffer(qry, ";\n");
+       appendPQExpBufferStr(qry, ";\n");
 
        ArchiveEntry(AH, nilCatalogId, createDumpId(),
                                 "ENCODING", NULL, NULL, "",
@@ -2530,13 +2530,13 @@ getBlobs(Archive *fout)
                                                  " FROM pg_largeobject_metadata",
                                                  username_subquery);
        else if (fout->remoteVersion >= 70100)
-               appendPQExpBuffer(blobQry,
-                                                 "SELECT DISTINCT loid, NULL::oid, NULL::oid"
-                                                 " FROM pg_largeobject");
+               appendPQExpBufferStr(blobQry,
+                                                        "SELECT DISTINCT loid, NULL::oid, NULL::oid"
+                                                        " FROM pg_largeobject");
        else
-               appendPQExpBuffer(blobQry,
-                                                 "SELECT oid, NULL::oid, NULL::oid"
-                                                 " FROM pg_class WHERE relkind = 'l'");
+               appendPQExpBufferStr(blobQry,
+                                                        "SELECT oid, NULL::oid, NULL::oid"
+                                                        " FROM pg_class WHERE relkind = 'l'");
 
        res = ExecuteSqlQuery(fout, blobQry->data, PGRES_TUPLES_OK);
 
@@ -2723,7 +2723,7 @@ binary_upgrade_set_type_oids_by_type_oid(Archive *fout,
        PGresult   *upgrade_res;
        Oid                     pg_type_array_oid;
 
-       appendPQExpBuffer(upgrade_buffer, "\n-- For binary upgrade, must preserve pg_type oid\n");
+       appendPQExpBufferStr(upgrade_buffer, "\n-- For binary upgrade, must preserve pg_type oid\n");
        appendPQExpBuffer(upgrade_buffer,
         "SELECT binary_upgrade.set_next_pg_type_oid('%u'::pg_catalog.oid);\n\n",
                                          pg_type_oid);
@@ -2741,7 +2741,7 @@ binary_upgrade_set_type_oids_by_type_oid(Archive *fout,
 
        if (OidIsValid(pg_type_array_oid))
        {
-               appendPQExpBuffer(upgrade_buffer,
+               appendPQExpBufferStr(upgrade_buffer,
                           "\n-- For binary upgrade, must preserve pg_type array oid\n");
                appendPQExpBuffer(upgrade_buffer,
                                                  "SELECT binary_upgrade.set_next_array_pg_type_oid('%u'::pg_catalog.oid);\n\n",
@@ -2784,7 +2784,7 @@ binary_upgrade_set_type_oids_by_rel_oid(Archive *fout,
                Oid                     pg_type_toast_oid = atooid(PQgetvalue(upgrade_res, 0,
                                                                                        PQfnumber(upgrade_res, "trel")));
 
-               appendPQExpBuffer(upgrade_buffer, "\n-- For binary upgrade, must preserve pg_type toast oid\n");
+               appendPQExpBufferStr(upgrade_buffer, "\n-- For binary upgrade, must preserve pg_type toast oid\n");
                appendPQExpBuffer(upgrade_buffer,
                                                  "SELECT binary_upgrade.set_next_toast_pg_type_oid('%u'::pg_catalog.oid);\n\n",
                                                  pg_type_toast_oid);
@@ -2820,8 +2820,8 @@ binary_upgrade_set_pg_class_oids(Archive *fout,
        pg_class_reltoastrelid = atooid(PQgetvalue(upgrade_res, 0, PQfnumber(upgrade_res, "reltoastrelid")));
        pg_index_indexrelid = atooid(PQgetvalue(upgrade_res, 0, PQfnumber(upgrade_res, "indexrelid")));
 
-       appendPQExpBuffer(upgrade_buffer,
-                                  "\n-- For binary upgrade, must preserve pg_class oids\n");
+       appendPQExpBufferStr(upgrade_buffer,
+                                                "\n-- For binary upgrade, must preserve pg_class oids\n");
 
        if (!is_index)
        {
@@ -2855,7 +2855,7 @@ binary_upgrade_set_pg_class_oids(Archive *fout,
                                                  "SELECT binary_upgrade.set_next_index_pg_class_oid('%u'::pg_catalog.oid);\n",
                                                  pg_class_oid);
 
-       appendPQExpBuffer(upgrade_buffer, "\n");
+       appendPQExpBufferChar(upgrade_buffer, '\n');
 
        PQclear(upgrade_res);
        destroyPQExpBuffer(upgrade_query);
@@ -2892,7 +2892,7 @@ binary_upgrade_extension_member(PQExpBuffer upgrade_buffer,
        if (extobj == NULL)
                exit_horribly(NULL, "could not find parent extension for %s\n", objlabel);
 
-       appendPQExpBuffer(upgrade_buffer,
+       appendPQExpBufferStr(upgrade_buffer,
          "\n-- For binary upgrade, handle extension membership the hard way\n");
        appendPQExpBuffer(upgrade_buffer, "ALTER EXTENSION %s ADD %s;\n",
                                          fmtId(extobj->name),
@@ -3079,10 +3079,10 @@ getExtensions(Archive *fout, int *numExtensions)
        /* Make sure we are in proper schema */
        selectSourceSchema(fout, "pg_catalog");
 
-       appendPQExpBuffer(query, "SELECT x.tableoid, x.oid, "
-                                         "x.extname, n.nspname, x.extrelocatable, x.extversion, x.extconfig, x.extcondition "
-                                         "FROM pg_extension x "
-                                         "JOIN pg_namespace n ON n.oid = x.extnamespace");
+       appendPQExpBufferStr(query, "SELECT x.tableoid, x.oid, "
+                                                "x.extname, n.nspname, x.extrelocatable, x.extversion, x.extconfig, x.extcondition "
+                                                "FROM pg_extension x "
+                                                "JOIN pg_namespace n ON n.oid = x.extnamespace");
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -3707,19 +3707,19 @@ getOpclasses(Archive *fout, int *numOpclasses)
        }
        else if (fout->remoteVersion >= 70100)
        {
-               appendPQExpBuffer(query, "SELECT tableoid, oid, opcname, "
-                                                 "0::oid AS opcnamespace, "
-                                                 "''::name AS rolname "
-                                                 "FROM pg_opclass");
+               appendPQExpBufferStr(query, "SELECT tableoid, oid, opcname, "
+                                                        "0::oid AS opcnamespace, "
+                                                        "''::name AS rolname "
+                                                        "FROM pg_opclass");
        }
        else
        {
-               appendPQExpBuffer(query, "SELECT "
-                                                 "(SELECT oid FROM pg_class WHERE relname = 'pg_opclass') AS tableoid, "
-                                                 "oid, opcname, "
-                                                 "0::oid AS opcnamespace, "
-                                                 "''::name AS rolname "
-                                                 "FROM pg_opclass");
+               appendPQExpBufferStr(query, "SELECT "
+                                                        "(SELECT oid FROM pg_class WHERE relname = 'pg_opclass') AS tableoid, "
+                                                        "oid, opcname, "
+                                                        "0::oid AS opcnamespace, "
+                                                        "''::name AS rolname "
+                                                        "FROM pg_opclass");
        }
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -3902,13 +3902,13 @@ getAggregates(Archive *fout, int *numAggs)
                                                  "WHERE nspname = 'pg_catalog')",
                                                  username_subquery);
                if (binary_upgrade && fout->remoteVersion >= 90100)
-                       appendPQExpBuffer(query,
-                                                         " OR EXISTS(SELECT 1 FROM pg_depend WHERE "
-                                                         "classid = 'pg_proc'::regclass AND "
-                                                         "objid = p.oid AND "
-                                                         "refclassid = 'pg_extension'::regclass AND "
-                                                         "deptype = 'e')");
-               appendPQExpBuffer(query, ")");
+                       appendPQExpBufferStr(query,
+                                                                " OR EXISTS(SELECT 1 FROM pg_depend WHERE "
+                                                                "classid = 'pg_proc'::regclass AND "
+                                                                "objid = p.oid AND "
+                                                                "refclassid = 'pg_extension'::regclass AND "
+                                                                "deptype = 'e')");
+               appendPQExpBufferChar(query, ')');
        }
        else if (fout->remoteVersion >= 80200)
        {
@@ -4094,18 +4094,18 @@ getFuncs(Archive *fout, int *numFuncs)
                                                  "WHERE nspname = 'pg_catalog')",
                                                  username_subquery);
                if (fout->remoteVersion >= 90200)
-                       appendPQExpBuffer(query,
-                                                         "\n  AND NOT EXISTS (SELECT 1 FROM pg_depend "
-                                                         "WHERE classid = 'pg_proc'::regclass AND "
-                                                         "objid = p.oid AND deptype = 'i')");
+                       appendPQExpBufferStr(query,
+                                                                "\n  AND NOT EXISTS (SELECT 1 FROM pg_depend "
+                                                                "WHERE classid = 'pg_proc'::regclass AND "
+                                                                "objid = p.oid AND deptype = 'i')");
                if (binary_upgrade && fout->remoteVersion >= 90100)
-                       appendPQExpBuffer(query,
-                                                         "\n  OR EXISTS(SELECT 1 FROM pg_depend WHERE "
-                                                         "classid = 'pg_proc'::regclass AND "
-                                                         "objid = p.oid AND "
-                                                         "refclassid = 'pg_extension'::regclass AND "
-                                                         "deptype = 'e')");
-               appendPQExpBuffer(query, ")");
+                       appendPQExpBufferStr(query,
+                                                                "\n  OR EXISTS(SELECT 1 FROM pg_depend WHERE "
+                                                                "classid = 'pg_proc'::regclass AND "
+                                                                "objid = p.oid AND "
+                                                                "refclassid = 'pg_extension'::regclass AND "
+                                                                "deptype = 'e')");
+               appendPQExpBufferChar(query, ')');
        }
        else if (fout->remoteVersion >= 70300)
        {
@@ -4721,7 +4721,7 @@ getTables(Archive *fout, int *numTables)
                 * applied to other things too.
                 */
                resetPQExpBuffer(query);
-               appendPQExpBuffer(query, "SET statement_timeout = ");
+               appendPQExpBufferStr(query, "SET statement_timeout = ");
                appendStringLiteralConn(query, lockWaitTimeout, GetConnection(fout));
                ExecuteSqlStatement(fout, query->data);
        }
@@ -4883,7 +4883,7 @@ getInherits(Archive *fout, int *numInherits)
 
        /* find all the inheritance information */
 
-       appendPQExpBuffer(query, "SELECT inhrelid, inhparent FROM pg_inherits");
+       appendPQExpBufferStr(query, "SELECT inhrelid, inhparent FROM pg_inherits");
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -5517,31 +5517,31 @@ getRules(Archive *fout, int *numRules)
 
        if (fout->remoteVersion >= 80300)
        {
-               appendPQExpBuffer(query, "SELECT "
-                                                 "tableoid, oid, rulename, "
-                                                 "ev_class AS ruletable, ev_type, is_instead, "
-                                                 "ev_enabled "
-                                                 "FROM pg_rewrite "
-                                                 "ORDER BY oid");
+               appendPQExpBufferStr(query, "SELECT "
+                                                        "tableoid, oid, rulename, "
+                                                        "ev_class AS ruletable, ev_type, is_instead, "
+                                                        "ev_enabled "
+                                                        "FROM pg_rewrite "
+                                                        "ORDER BY oid");
        }
        else if (fout->remoteVersion >= 70100)
        {
-               appendPQExpBuffer(query, "SELECT "
-                                                 "tableoid, oid, rulename, "
-                                                 "ev_class AS ruletable, ev_type, is_instead, "
-                                                 "'O'::char AS ev_enabled "
-                                                 "FROM pg_rewrite "
-                                                 "ORDER BY oid");
+               appendPQExpBufferStr(query, "SELECT "
+                                                        "tableoid, oid, rulename, "
+                                                        "ev_class AS ruletable, ev_type, is_instead, "
+                                                        "'O'::char AS ev_enabled "
+                                                        "FROM pg_rewrite "
+                                                        "ORDER BY oid");
        }
        else
        {
-               appendPQExpBuffer(query, "SELECT "
-                                                 "(SELECT oid FROM pg_class WHERE relname = 'pg_rewrite') AS tableoid, "
-                                                 "oid, rulename, "
-                                                 "ev_class AS ruletable, ev_type, is_instead, "
-                                                 "'O'::char AS ev_enabled "
-                                                 "FROM pg_rewrite "
-                                                 "ORDER BY oid");
+               appendPQExpBufferStr(query, "SELECT "
+                                                        "(SELECT oid FROM pg_class WHERE relname = 'pg_rewrite') AS tableoid, "
+                                                        "oid, rulename, "
+                                                        "ev_class AS ruletable, ev_type, is_instead, "
+                                                        "'O'::char AS ev_enabled "
+                                                        "FROM pg_rewrite "
+                                                        "ORDER BY oid");
        }
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -6010,17 +6010,17 @@ getProcLangs(Archive *fout, int *numProcLangs)
        else if (fout->remoteVersion >= 70100)
        {
                /* No clear notion of an owner at all before 7.4 ... */
-               appendPQExpBuffer(query, "SELECT tableoid, oid, * FROM pg_language "
-                                                 "WHERE lanispl "
-                                                 "ORDER BY oid");
+               appendPQExpBufferStr(query, "SELECT tableoid, oid, * FROM pg_language "
+                                                        "WHERE lanispl "
+                                                        "ORDER BY oid");
        }
        else
        {
-               appendPQExpBuffer(query, "SELECT "
-                                                 "(SELECT oid FROM pg_class WHERE relname = 'pg_language') AS tableoid, "
-                                                 "oid, * FROM pg_language "
-                                                 "WHERE lanispl "
-                                                 "ORDER BY oid");
+               appendPQExpBufferStr(query, "SELECT "
+                                                        "(SELECT oid FROM pg_class WHERE relname = 'pg_language') AS tableoid, "
+                                                        "oid, * FROM pg_language "
+                                                        "WHERE lanispl "
+                                                        "ORDER BY oid");
        }
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -6118,29 +6118,29 @@ getCasts(Archive *fout, int *numCasts)
 
        if (fout->remoteVersion >= 80400)
        {
-               appendPQExpBuffer(query, "SELECT tableoid, oid, "
-                                                 "castsource, casttarget, castfunc, castcontext, "
-                                                 "castmethod "
-                                                 "FROM pg_cast ORDER BY 3,4");
+               appendPQExpBufferStr(query, "SELECT tableoid, oid, "
+                                                        "castsource, casttarget, castfunc, castcontext, "
+                                                        "castmethod "
+                                                        "FROM pg_cast ORDER BY 3,4");
        }
        else if (fout->remoteVersion >= 70300)
        {
-               appendPQExpBuffer(query, "SELECT tableoid, oid, "
-                                                 "castsource, casttarget, castfunc, castcontext, "
+               appendPQExpBufferStr(query, "SELECT tableoid, oid, "
+                                                        "castsource, casttarget, castfunc, castcontext, "
                                "CASE WHEN castfunc = 0 THEN 'b' ELSE 'f' END AS castmethod "
-                                                 "FROM pg_cast ORDER BY 3,4");
+                                                        "FROM pg_cast ORDER BY 3,4");
        }
        else
        {
-               appendPQExpBuffer(query, "SELECT 0 AS tableoid, p.oid, "
-                                                 "t1.oid AS castsource, t2.oid AS casttarget, "
-                                                 "p.oid AS castfunc, 'e' AS castcontext, "
-                                                 "'f' AS castmethod "
-                                                 "FROM pg_type t1, pg_type t2, pg_proc p "
-                                                 "WHERE p.pronargs = 1 AND "
-                                                 "p.proargtypes[0] = t1.oid AND "
-                                                 "p.prorettype = t2.oid AND p.proname = t2.typname "
-                                                 "ORDER BY 3,4");
+               appendPQExpBufferStr(query, "SELECT 0 AS tableoid, p.oid, "
+                                                        "t1.oid AS castsource, t2.oid AS casttarget, "
+                                                        "p.oid AS castfunc, 'e' AS castcontext, "
+                                                        "'f' AS castmethod "
+                                                        "FROM pg_type t1, pg_type t2, pg_proc p "
+                                                        "WHERE p.pronargs = 1 AND "
+                                                        "p.proargtypes[0] = t1.oid AND "
+                                                        "p.prorettype = t2.oid AND p.proname = t2.typname "
+                                                        "ORDER BY 3,4");
        }
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -6840,10 +6840,10 @@ getTSParsers(Archive *fout, int *numTSParsers)
        /* Make sure we are in proper schema */
        selectSourceSchema(fout, "pg_catalog");
 
-       appendPQExpBuffer(query, "SELECT tableoid, oid, prsname, prsnamespace, "
-                                         "prsstart::oid, prstoken::oid, "
-                                         "prsend::oid, prsheadline::oid, prslextype::oid "
-                                         "FROM pg_ts_parser");
+       appendPQExpBufferStr(query, "SELECT tableoid, oid, prsname, prsnamespace, "
+                                                "prsstart::oid, prstoken::oid, "
+                                                "prsend::oid, prsheadline::oid, prslextype::oid "
+                                                "FROM pg_ts_parser");
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -7009,9 +7009,9 @@ getTSTemplates(Archive *fout, int *numTSTemplates)
        /* Make sure we are in proper schema */
        selectSourceSchema(fout, "pg_catalog");
 
-       appendPQExpBuffer(query, "SELECT tableoid, oid, tmplname, "
-                                         "tmplnamespace, tmplinit::oid, tmpllexize::oid "
-                                         "FROM pg_ts_template");
+       appendPQExpBufferStr(query, "SELECT tableoid, oid, tmplname, "
+                                                "tmplnamespace, tmplinit::oid, tmpllexize::oid "
+                                                "FROM pg_ts_template");
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -7471,7 +7471,7 @@ dumpComment(Archive *fout, const char *target,
 
                appendPQExpBuffer(query, "COMMENT ON %s IS ", target);
                appendStringLiteralAH(query, comments->descr, fout);
-               appendPQExpBuffer(query, ";\n");
+               appendPQExpBufferStr(query, ";\n");
 
                /*
                 * We mark comments as SECTION_NONE because they really belong in the
@@ -7535,7 +7535,7 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo,
                        resetPQExpBuffer(query);
                        appendPQExpBuffer(query, "COMMENT ON %s IS ", target->data);
                        appendStringLiteralAH(query, descr, fout);
-                       appendPQExpBuffer(query, ";\n");
+                       appendPQExpBufferStr(query, ";\n");
 
                        ArchiveEntry(fout, nilCatalogId, createDumpId(),
                                                 target->data,
@@ -7551,13 +7551,12 @@ dumpTableComment(Archive *fout, TableInfo *tbinfo,
                        resetPQExpBuffer(target);
                        appendPQExpBuffer(target, "COLUMN %s.",
                                                          fmtId(tbinfo->dobj.name));
-                       appendPQExpBuffer(target, "%s",
-                                                         fmtId(tbinfo->attnames[objsubid - 1]));
+                       appendPQExpBufferStr(target, fmtId(tbinfo->attnames[objsubid - 1]));
 
                        resetPQExpBuffer(query);
                        appendPQExpBuffer(query, "COMMENT ON %s IS ", target->data);
                        appendStringLiteralAH(query, descr, fout);
-                       appendPQExpBuffer(query, ";\n");
+                       appendPQExpBufferStr(query, ";\n");
 
                        ArchiveEntry(fout, nilCatalogId, createDumpId(),
                                                 target->data,
@@ -7698,22 +7697,22 @@ collectComments(Archive *fout, CommentItem **items)
 
        if (fout->remoteVersion >= 70300)
        {
-               appendPQExpBuffer(query, "SELECT description, classoid, objoid, objsubid "
-                                                 "FROM pg_catalog.pg_description "
-                                                 "ORDER BY classoid, objoid, objsubid");
+               appendPQExpBufferStr(query, "SELECT description, classoid, objoid, objsubid "
+                                                        "FROM pg_catalog.pg_description "
+                                                        "ORDER BY classoid, objoid, objsubid");
        }
        else if (fout->remoteVersion >= 70200)
        {
-               appendPQExpBuffer(query, "SELECT description, classoid, objoid, objsubid "
-                                                 "FROM pg_description "
-                                                 "ORDER BY classoid, objoid, objsubid");
+               appendPQExpBufferStr(query, "SELECT description, classoid, objoid, objsubid "
+                                                        "FROM pg_description "
+                                                        "ORDER BY classoid, objoid, objsubid");
        }
        else
        {
                /* Note: this will fail to find attribute comments in pre-7.2... */
-               appendPQExpBuffer(query, "SELECT description, 0 AS classoid, objoid, 0 AS objsubid "
-                                                 "FROM pg_description "
-                                                 "ORDER BY objoid");
+               appendPQExpBufferStr(query, "SELECT description, 0 AS classoid, objoid, 0 AS objsubid "
+                                                        "FROM pg_description "
+                                                        "ORDER BY objoid");
        }
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
@@ -7976,7 +7975,7 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo)
                int                     i;
                int                     n;
 
-               appendPQExpBuffer(q, "-- For binary upgrade, create an empty extension and insert objects into it\n");
+               appendPQExpBufferStr(q, "-- For binary upgrade, create an empty extension and insert objects into it\n");
 
                /*
                 * We unconditionally create the extension, so we must drop it if it
@@ -7987,15 +7986,15 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo)
                 */
                appendPQExpBuffer(q, "DROP EXTENSION IF EXISTS %s;\n", qextname);
 
-               appendPQExpBuffer(q,
+               appendPQExpBufferStr(q,
                                                  "SELECT binary_upgrade.create_empty_extension(");
                appendStringLiteralAH(q, extinfo->dobj.name, fout);
-               appendPQExpBuffer(q, ", ");
+               appendPQExpBufferStr(q, ", ");
                appendStringLiteralAH(q, extinfo->namespace, fout);
-               appendPQExpBuffer(q, ", ");
+               appendPQExpBufferStr(q, ", ");
                appendPQExpBuffer(q, "%s, ", extinfo->relocatable ? "true" : "false");
                appendStringLiteralAH(q, extinfo->extversion, fout);
-               appendPQExpBuffer(q, ", ");
+               appendPQExpBufferStr(q, ", ");
 
                /*
                 * Note that we're pushing extconfig (an OID array) back into
@@ -8005,14 +8004,14 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo)
                if (strlen(extinfo->extconfig) > 2)
                        appendStringLiteralAH(q, extinfo->extconfig, fout);
                else
-                       appendPQExpBuffer(q, "NULL");
-               appendPQExpBuffer(q, ", ");
+                       appendPQExpBufferStr(q, "NULL");
+               appendPQExpBufferStr(q, ", ");
                if (strlen(extinfo->extcondition) > 2)
                        appendStringLiteralAH(q, extinfo->extcondition, fout);
                else
-                       appendPQExpBuffer(q, "NULL");
-               appendPQExpBuffer(q, ", ");
-               appendPQExpBuffer(q, "ARRAY[");
+                       appendPQExpBufferStr(q, "NULL");
+               appendPQExpBufferStr(q, ", ");
+               appendPQExpBufferStr(q, "ARRAY[");
                n = 0;
                for (i = 0; i < extinfo->dobj.nDeps; i++)
                {
@@ -8022,12 +8021,12 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo)
                        if (extobj && extobj->objType == DO_EXTENSION)
                        {
                                if (n++ > 0)
-                                       appendPQExpBuffer(q, ",");
+                                       appendPQExpBufferChar(q, ',');
                                appendStringLiteralAH(q, extobj->name, fout);
                        }
                }
-               appendPQExpBuffer(q, "]::pg_catalog.text[]");
-               appendPQExpBuffer(q, ");\n");
+               appendPQExpBufferStr(q, "]::pg_catalog.text[]");
+               appendPQExpBufferStr(q, ");\n");
        }
 
        appendPQExpBuffer(labelq, "EXTENSION %s", qextname);
@@ -8147,13 +8146,13 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo)
                {
                        label = PQgetvalue(res, i, PQfnumber(res, "enumlabel"));
                        if (i > 0)
-                               appendPQExpBuffer(q, ",");
-                       appendPQExpBuffer(q, "\n    ");
+                               appendPQExpBufferChar(q, ',');
+                       appendPQExpBufferStr(q, "\n    ");
                        appendStringLiteralAH(q, label, fout);
                }
        }
 
-       appendPQExpBuffer(q, "\n);\n");
+       appendPQExpBufferStr(q, "\n);\n");
 
        if (binary_upgrade)
        {
@@ -8164,7 +8163,7 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo)
                        label = PQgetvalue(res, i, PQfnumber(res, "enumlabel"));
 
                        if (i == 0)
-                               appendPQExpBuffer(q, "\n-- For binary upgrade, must preserve pg_enum oids\n");
+                               appendPQExpBufferStr(q, "\n-- For binary upgrade, must preserve pg_enum oids\n");
                        appendPQExpBuffer(q,
                                                          "SELECT binary_upgrade.set_next_pg_enum_oid('%u'::pg_catalog.oid);\n",
                                                          enum_oid);
@@ -8173,7 +8172,7 @@ dumpEnumType(Archive *fout, TypeInfo *tyinfo)
                        appendPQExpBuffer(q, "%s ADD VALUE ",
                                                          qtypname);
                        appendStringLiteralAH(q, label, fout);
-                       appendPQExpBuffer(q, ";\n\n");
+                       appendPQExpBufferStr(q, ";\n\n");
                }
        }
 
@@ -8282,7 +8281,7 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo)
                /* always schema-qualify, don't try to be smart */
                appendPQExpBuffer(q, ",\n    subtype_opclass = %s.",
                                                  fmtId(nspname));
-               appendPQExpBuffer(q, "%s", fmtId(opcname));
+               appendPQExpBufferStr(q, fmtId(opcname));
        }
 
        collationOid = atooid(PQgetvalue(res, 0, PQfnumber(res, "collation")));
@@ -8295,8 +8294,7 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo)
                        /* always schema-qualify, don't try to be smart */
                        appendPQExpBuffer(q, ",\n    collation = %s.",
                                                          fmtId(coll->dobj.namespace->dobj.name));
-                       appendPQExpBuffer(q, "%s",
-                                                         fmtId(coll->dobj.name));
+                       appendPQExpBufferStr(q, fmtId(coll->dobj.name));
                }
        }
 
@@ -8308,7 +8306,7 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo)
        if (strcmp(procname, "-") != 0)
                appendPQExpBuffer(q, ",\n    subtype_diff = %s", procname);
 
-       appendPQExpBuffer(q, "\n);\n");
+       appendPQExpBufferStr(q, "\n);\n");
 
        appendPQExpBuffer(labelq, "TYPE %s", qtypname);
 
@@ -8640,11 +8638,11 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
        }
 
        if (strcmp(typcollatable, "t") == 0)
-               appendPQExpBuffer(q, ",\n    COLLATABLE = true");
+               appendPQExpBufferStr(q, ",\n    COLLATABLE = true");
 
        if (typdefault != NULL)
        {
-               appendPQExpBuffer(q, ",\n    DEFAULT = ");
+               appendPQExpBufferStr(q, ",\n    DEFAULT = ");
                if (typdefault_is_literal)
                        appendStringLiteralAH(q, typdefault, fout);
                else
@@ -8664,41 +8662,41 @@ dumpBaseType(Archive *fout, TypeInfo *tyinfo)
 
        if (strcmp(typcategory, "U") != 0)
        {
-               appendPQExpBuffer(q, ",\n    CATEGORY = ");
+               appendPQExpBufferStr(q, ",\n    CATEGORY = ");
                appendStringLiteralAH(q, typcategory, fout);
        }
 
        if (strcmp(typispreferred, "t") == 0)
-               appendPQExpBuffer(q, ",\n    PREFERRED = true");
+               appendPQExpBufferStr(q, ",\n    PREFERRED = true");
 
        if (typdelim && strcmp(typdelim, ",") != 0)
        {
-               appendPQExpBuffer(q, ",\n    DELIMITER = ");
+               appendPQExpBufferStr(q, ",\n    DELIMITER = ");
                appendStringLiteralAH(q, typdelim, fout);
        }
 
        if (strcmp(typalign, "c") == 0)
-               appendPQExpBuffer(q, ",\n    ALIGNMENT = char");
+               appendPQExpBufferStr(q, ",\n    ALIGNMENT = char");
        else if (strcmp(typalign, "s") == 0)
-               appendPQExpBuffer(q, ",\n    ALIGNMENT = int2");
+               appendPQExpBufferStr(q, ",\n    ALIGNMENT = int2");
        else if (strcmp(typalign, "i") == 0)
-               appendPQExpBuffer(q, ",\n    ALIGNMENT = int4");
+               appendPQExpBufferStr(q, ",\n    ALIGNMENT = int4");
        else if (strcmp(typalign, "d") == 0)
-               appendPQExpBuffer(q, ",\n    ALIGNMENT = double");
+               appendPQExpBufferStr(q, ",\n    ALIGNMENT = double");
 
        if (strcmp(typstorage, "p") == 0)
-               appendPQExpBuffer(q, ",\n    STORAGE = plain");
+               appendPQExpBufferStr(q, ",\n    STORAGE = plain");
        else if (strcmp(typstorage, "e") == 0)
-               appendPQExpBuffer(q, ",\n    STORAGE = external");
+               appendPQExpBufferStr(q, ",\n    STORAGE = external");
        else if (strcmp(typstorage, "x") == 0)
-               appendPQExpBuffer(q, ",\n    STORAGE = extended");
+               appendPQExpBufferStr(q, ",\n    STORAGE = extended");
        else if (strcmp(typstorage, "m") == 0)
-               appendPQExpBuffer(q, ",\n    STORAGE = main");
+               appendPQExpBufferStr(q, ",\n    STORAGE = main");
 
        if (strcmp(typbyval, "t") == 0)
-               appendPQExpBuffer(q, ",\n    PASSEDBYVALUE");
+               appendPQExpBufferStr(q, ",\n    PASSEDBYVALUE");
 
-       appendPQExpBuffer(q, "\n);\n");
+       appendPQExpBufferStr(q, "\n);\n");
 
        appendPQExpBuffer(labelq, "TYPE %s", qtypname);
 
@@ -8822,17 +8820,16 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo)
                        /* always schema-qualify, don't try to be smart */
                        appendPQExpBuffer(q, " COLLATE %s.",
                                                          fmtId(coll->dobj.namespace->dobj.name));
-                       appendPQExpBuffer(q, "%s",
-                                                         fmtId(coll->dobj.name));
+                       appendPQExpBufferStr(q, fmtId(coll->dobj.name));
                }
        }
 
        if (typnotnull[0] == 't')
-               appendPQExpBuffer(q, " NOT NULL");
+               appendPQExpBufferStr(q, " NOT NULL");
 
        if (typdefault != NULL)
        {
-               appendPQExpBuffer(q, " DEFAULT ");
+               appendPQExpBufferStr(q, " DEFAULT ");
                if (typdefault_is_literal)
                        appendStringLiteralAH(q, typdefault, fout);
                else
@@ -8853,7 +8850,7 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo)
                                                          fmtId(domcheck->dobj.name), domcheck->condef);
        }
 
-       appendPQExpBuffer(q, ";\n");
+       appendPQExpBufferStr(q, ";\n");
 
        /*
         * DROP must be fully qualified in case same name appears in pg_catalog
@@ -9016,8 +9013,8 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
 
                /* Format properly if not first attr */
                if (actual_atts++ > 0)
-                       appendPQExpBuffer(q, ",");
-               appendPQExpBuffer(q, "\n\t");
+                       appendPQExpBufferChar(q, ',');
+               appendPQExpBufferStr(q, "\n\t");
 
                if (!attisdropped)
                {
@@ -9034,8 +9031,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
                                        /* always schema-qualify, don't try to be smart */
                                        appendPQExpBuffer(q, " COLLATE %s.",
                                                                          fmtId(coll->dobj.namespace->dobj.name));
-                                       appendPQExpBuffer(q, "%s",
-                                                                         fmtId(coll->dobj.name));
+                                       appendPQExpBufferStr(q, fmtId(coll->dobj.name));
                                }
                        }
                }
@@ -9050,16 +9046,16 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
                        appendPQExpBuffer(q, "%s INTEGER /* dummy */", fmtId(attname));
 
                        /* stash separately for insertion after the CREATE TYPE */
-                       appendPQExpBuffer(dropped,
+                       appendPQExpBufferStr(dropped,
                                          "\n-- For binary upgrade, recreate dropped column.\n");
                        appendPQExpBuffer(dropped, "UPDATE pg_catalog.pg_attribute\n"
                                                          "SET attlen = %s, "
                                                          "attalign = '%s', attbyval = false\n"
                                                          "WHERE attname = ", attlen, attalign);
                        appendStringLiteralAH(dropped, attname, fout);
-                       appendPQExpBuffer(dropped, "\n  AND attrelid = ");
+                       appendPQExpBufferStr(dropped, "\n  AND attrelid = ");
                        appendStringLiteralAH(dropped, qtypname, fout);
-                       appendPQExpBuffer(dropped, "::pg_catalog.regclass;\n");
+                       appendPQExpBufferStr(dropped, "::pg_catalog.regclass;\n");
 
                        appendPQExpBuffer(dropped, "ALTER TYPE %s ",
                                                          qtypname);
@@ -9067,7 +9063,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
                                                          fmtId(attname));
                }
        }
-       appendPQExpBuffer(q, "\n);\n");
+       appendPQExpBufferStr(q, "\n);\n");
        appendPQExpBufferStr(q, dropped->data);
 
        /*
@@ -9200,13 +9196,12 @@ dumpCompositeTypeColComments(Archive *fout, TypeInfo *tyinfo)
                        resetPQExpBuffer(target);
                        appendPQExpBuffer(target, "COLUMN %s.",
                                                          fmtId(tyinfo->dobj.name));
-                       appendPQExpBuffer(target, "%s",
-                                                         fmtId(attname));
+                       appendPQExpBufferStr(target, fmtId(attname));
 
                        resetPQExpBuffer(query);
                        appendPQExpBuffer(query, "COMMENT ON %s IS ", target->data);
                        appendStringLiteralAH(query, descr, fout);
-                       appendPQExpBuffer(query, ";\n");
+                       appendPQExpBufferStr(query, ";\n");
 
                        ArchiveEntry(fout, nilCatalogId, createDumpId(),
                                                 target->data,
@@ -9396,23 +9391,21 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang)
                                                  fmtId(funcInfo->dobj.name));
                if (OidIsValid(plang->laninline))
                {
-                       appendPQExpBuffer(defqry, " INLINE ");
+                       appendPQExpBufferStr(defqry, " INLINE ");
                        /* Cope with possibility that inline is in different schema */
                        if (inlineInfo->dobj.namespace != funcInfo->dobj.namespace)
                                appendPQExpBuffer(defqry, "%s.",
                                                           fmtId(inlineInfo->dobj.namespace->dobj.name));
-                       appendPQExpBuffer(defqry, "%s",
-                                                         fmtId(inlineInfo->dobj.name));
+                       appendPQExpBufferStr(defqry, fmtId(inlineInfo->dobj.name));
                }
                if (OidIsValid(plang->lanvalidator))
                {
-                       appendPQExpBuffer(defqry, " VALIDATOR ");
+                       appendPQExpBufferStr(defqry, " VALIDATOR ");
                        /* Cope with possibility that validator is in different schema */
                        if (validatorInfo->dobj.namespace != funcInfo->dobj.namespace)
                                appendPQExpBuffer(defqry, "%s.",
                                                        fmtId(validatorInfo->dobj.namespace->dobj.name));
-                       appendPQExpBuffer(defqry, "%s",
-                                                         fmtId(validatorInfo->dobj.name));
+                       appendPQExpBufferStr(defqry, fmtId(validatorInfo->dobj.name));
                }
        }
        else
@@ -9429,7 +9422,7 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang)
                appendPQExpBuffer(defqry, "CREATE OR REPLACE PROCEDURAL LANGUAGE %s",
                                                  qlanname);
        }
-       appendPQExpBuffer(defqry, ";\n");
+       appendPQExpBufferStr(defqry, ";\n");
 
        appendPQExpBuffer(labelq, "LANGUAGE %s", qlanname);
 
@@ -9478,9 +9471,9 @@ format_function_arguments(FuncInfo *finfo, char *funcargs, bool is_agg)
        PQExpBufferData fn;
 
        initPQExpBuffer(&fn);
-       appendPQExpBuffer(&fn, "%s", fmtId(finfo->dobj.name));
+       appendPQExpBufferStr(&fn, fmtId(finfo->dobj.name));
        if (is_agg && finfo->nargs == 0)
-               appendPQExpBuffer(&fn, "(*)");
+               appendPQExpBufferStr(&fn, "(*)");
        else
                appendPQExpBuffer(&fn, "(%s)", funcargs);
        return fn.data;
@@ -9553,7 +9546,7 @@ format_function_arguments_old(Archive *fout,
                                                  typname);
                free(typname);
        }
-       appendPQExpBuffer(&fn, ")");
+       appendPQExpBufferChar(&fn, ')');
        return fn.data;
 }
 
@@ -9582,15 +9575,15 @@ format_function_signature(Archive *fout, FuncInfo *finfo, bool honor_quotes)
        {
                char       *typname;
 
+               if (j > 0)
+                       appendPQExpBufferStr(&fn, ", ");
+
                typname = getFormattedTypeName(fout, finfo->argtypes[j],
                                                                           zeroAsOpaque);
-
-               appendPQExpBuffer(&fn, "%s%s",
-                                                 (j > 0) ? ", " : "",
-                                                 typname);
+               appendPQExpBufferStr(&fn, typname);
                free(typname);
        }
-       appendPQExpBuffer(&fn, ")");
+       appendPQExpBufferChar(&fn, ')');
        return fn.data;
 }
 
@@ -9822,11 +9815,11 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
         */
        if (probin[0] != '\0' && strcmp(probin, "-") != 0)
        {
-               appendPQExpBuffer(asPart, "AS ");
+               appendPQExpBufferStr(asPart, "AS ");
                appendStringLiteralAH(asPart, probin, fout);
                if (strcmp(prosrc, "-") != 0)
                {
-                       appendPQExpBuffer(asPart, ", ");
+                       appendPQExpBufferStr(asPart, ", ");
 
                        /*
                         * where we have bin, use dollar quoting if allowed and src
@@ -9843,7 +9836,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
        {
                if (strcmp(prosrc, "-") != 0)
                {
-                       appendPQExpBuffer(asPart, "AS ");
+                       appendPQExpBufferStr(asPart, "AS ");
                        /* with no bin, dollar quote src unconditionally if allowed */
                        if (disable_dollar_quoting)
                                appendStringLiteralAH(asPart, prosrc, fout);
@@ -9950,27 +9943,27 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
        appendPQExpBuffer(q, "\n    LANGUAGE %s", fmtId(lanname));
 
        if (proiswindow[0] == 't')
-               appendPQExpBuffer(q, " WINDOW");
+               appendPQExpBufferStr(q, " WINDOW");
 
        if (provolatile[0] != PROVOLATILE_VOLATILE)
        {
                if (provolatile[0] == PROVOLATILE_IMMUTABLE)
-                       appendPQExpBuffer(q, " IMMUTABLE");
+                       appendPQExpBufferStr(q, " IMMUTABLE");
                else if (provolatile[0] == PROVOLATILE_STABLE)
-                       appendPQExpBuffer(q, " STABLE");
+                       appendPQExpBufferStr(q, " STABLE");
                else if (provolatile[0] != PROVOLATILE_VOLATILE)
                        exit_horribly(NULL, "unrecognized provolatile value for function \"%s\"\n",
                                                  finfo->dobj.name);
        }
 
        if (proisstrict[0] == 't')
-               appendPQExpBuffer(q, " STRICT");
+               appendPQExpBufferStr(q, " STRICT");
 
        if (prosecdef[0] == 't')
-               appendPQExpBuffer(q, " SECURITY DEFINER");
+               appendPQExpBufferStr(q, " SECURITY DEFINER");
 
        if (proleakproof[0] == 't')
-               appendPQExpBuffer(q, " LEAKPROOF");
+               appendPQExpBufferStr(q, " LEAKPROOF");
 
        /*
         * COST and ROWS are emitted only if present and not default, so as not to
@@ -10014,7 +10007,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
                 */
                if (pg_strcasecmp(configitem, "DateStyle") == 0
                        || pg_strcasecmp(configitem, "search_path") == 0)
-                       appendPQExpBuffer(q, "%s", pos);
+                       appendPQExpBufferStr(q, pos);
                else
                        appendStringLiteralAH(q, pos, fout);
        }
@@ -10159,10 +10152,10 @@ dumpCast(Archive *fout, CastInfo *cast)
        switch (cast->castmethod)
        {
                case COERCION_METHOD_BINARY:
-                       appendPQExpBuffer(defqry, "WITHOUT FUNCTION");
+                       appendPQExpBufferStr(defqry, "WITHOUT FUNCTION");
                        break;
                case COERCION_METHOD_INOUT:
-                       appendPQExpBuffer(defqry, "WITH INOUT");
+                       appendPQExpBufferStr(defqry, "WITH INOUT");
                        break;
                case COERCION_METHOD_FUNCTION:
                        if (funcInfo)
@@ -10186,10 +10179,10 @@ dumpCast(Archive *fout, CastInfo *cast)
        }
 
        if (cast->castcontext == 'a')
-               appendPQExpBuffer(defqry, " AS ASSIGNMENT");
+               appendPQExpBufferStr(defqry, " AS ASSIGNMENT");
        else if (cast->castcontext == 'i')
-               appendPQExpBuffer(defqry, " AS IMPLICIT");
-       appendPQExpBuffer(defqry, ";\n");
+               appendPQExpBufferStr(defqry, " AS IMPLICIT");
+       appendPQExpBufferStr(defqry, ";\n");
 
        appendPQExpBuffer(labelq, "CAST (%s AS %s)",
                                        getFormattedTypeName(fout, cast->castsource, zeroAsNone),
@@ -10375,10 +10368,10 @@ dumpOpr(Archive *fout, OprInfo *oprinfo)
                else
                        name = fmtId(oprleft);
                appendPQExpBuffer(details, ",\n    LEFTARG = %s", name);
-               appendPQExpBuffer(oprid, "%s", name);
+               appendPQExpBufferStr(oprid, name);
        }
        else
-               appendPQExpBuffer(oprid, "NONE");
+               appendPQExpBufferStr(oprid, "NONE");
 
        if (strcmp(oprkind, "l") == 0 ||
                strcmp(oprkind, "b") == 0)
@@ -10391,7 +10384,7 @@ dumpOpr(Archive *fout, OprInfo *oprinfo)
                appendPQExpBuffer(oprid, ", %s)", name);
        }
        else
-               appendPQExpBuffer(oprid, ", NONE)");
+               appendPQExpBufferStr(oprid, ", NONE)");
 
        name = convertOperatorReference(fout, oprcom);
        if (name)
@@ -10402,10 +10395,10 @@ dumpOpr(Archive *fout, OprInfo *oprinfo)
                appendPQExpBuffer(details, ",\n    NEGATOR = %s", name);
 
        if (strcmp(oprcanmerge, "t") == 0)
-               appendPQExpBuffer(details, ",\n    MERGES");
+               appendPQExpBufferStr(details, ",\n    MERGES");
 
        if (strcmp(oprcanhash, "t") == 0)
-               appendPQExpBuffer(details, ",\n    HASHES");
+               appendPQExpBufferStr(details, ",\n    HASHES");
 
        name = convertRegProcReference(fout, oprrest);
        if (name)
@@ -10714,7 +10707,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
        appendPQExpBuffer(q, "CREATE OPERATOR CLASS %s\n    ",
                                          fmtId(opcinfo->dobj.name));
        if (strcmp(opcdefault, "t") == 0)
-               appendPQExpBuffer(q, "DEFAULT ");
+               appendPQExpBufferStr(q, "DEFAULT ");
        appendPQExpBuffer(q, "FOR TYPE %s USING %s",
                                          opcintype,
                                          fmtId(amname));
@@ -10722,12 +10715,12 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
                (strcmp(opcfamilyname, opcinfo->dobj.name) != 0 ||
                 strcmp(opcfamilynsp, opcinfo->dobj.namespace->dobj.name) != 0))
        {
-               appendPQExpBuffer(q, " FAMILY ");
+               appendPQExpBufferStr(q, " FAMILY ");
                if (strcmp(opcfamilynsp, opcinfo->dobj.namespace->dobj.name) != 0)
                        appendPQExpBuffer(q, "%s.", fmtId(opcfamilynsp));
                appendPQExpBuffer(q, "%s", fmtId(opcfamilyname));
        }
-       appendPQExpBuffer(q, " AS\n    ");
+       appendPQExpBufferStr(q, " AS\n    ");
 
        needComma = false;
 
@@ -10834,21 +10827,21 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
                sortfamilynsp = PQgetvalue(res, i, i_sortfamilynsp);
 
                if (needComma)
-                       appendPQExpBuffer(q, " ,\n    ");
+                       appendPQExpBufferStr(q, " ,\n    ");
 
                appendPQExpBuffer(q, "OPERATOR %s %s",
                                                  amopstrategy, amopopr);
 
                if (strlen(sortfamily) > 0)
                {
-                       appendPQExpBuffer(q, " FOR ORDER BY ");
+                       appendPQExpBufferStr(q, " FOR ORDER BY ");
                        if (strcmp(sortfamilynsp, opcinfo->dobj.namespace->dobj.name) != 0)
                                appendPQExpBuffer(q, "%s.", fmtId(sortfamilynsp));
-                       appendPQExpBuffer(q, "%s", fmtId(sortfamily));
+                       appendPQExpBufferStr(q, fmtId(sortfamily));
                }
 
                if (strcmp(amopreqcheck, "t") == 0)
-                       appendPQExpBuffer(q, " RECHECK");
+                       appendPQExpBufferStr(q, " RECHECK");
 
                needComma = true;
        }
@@ -10912,7 +10905,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
                amprocrighttype = PQgetvalue(res, i, i_amprocrighttype);
 
                if (needComma)
-                       appendPQExpBuffer(q, " ,\n    ");
+                       appendPQExpBufferStr(q, " ,\n    ");
 
                appendPQExpBuffer(q, "FUNCTION %s", amprocnum);
 
@@ -10926,7 +10919,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo)
 
        PQclear(res);
 
-       appendPQExpBuffer(q, ";\n");
+       appendPQExpBufferStr(q, ";\n");
 
        appendPQExpBuffer(labelq, "OPERATOR CLASS %s",
                                          fmtId(opcinfo->dobj.name));
@@ -11192,21 +11185,21 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo)
                        sortfamilynsp = PQgetvalue(res_ops, i, i_sortfamilynsp);
 
                        if (needComma)
-                               appendPQExpBuffer(q, " ,\n    ");
+                               appendPQExpBufferStr(q, " ,\n    ");
 
                        appendPQExpBuffer(q, "OPERATOR %s %s",
                                                          amopstrategy, amopopr);
 
                        if (strlen(sortfamily) > 0)
                        {
-                               appendPQExpBuffer(q, " FOR ORDER BY ");
+                               appendPQExpBufferStr(q, " FOR ORDER BY ");
                                if (strcmp(sortfamilynsp, opfinfo->dobj.namespace->dobj.name) != 0)
                                        appendPQExpBuffer(q, "%s.", fmtId(sortfamilynsp));
-                               appendPQExpBuffer(q, "%s", fmtId(sortfamily));
+                               appendPQExpBufferStr(q, fmtId(sortfamily));
                        }
 
                        if (strcmp(amopreqcheck, "t") == 0)
-                               appendPQExpBuffer(q, " RECHECK");
+                               appendPQExpBufferStr(q, " RECHECK");
 
                        needComma = true;
                }
@@ -11229,7 +11222,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo)
                        amprocrighttype = PQgetvalue(res_procs, i, i_amprocrighttype);
 
                        if (needComma)
-                               appendPQExpBuffer(q, " ,\n    ");
+                               appendPQExpBufferStr(q, " ,\n    ");
 
                        appendPQExpBuffer(q, "FUNCTION %s (%s, %s) %s",
                                                          amprocnum, amproclefttype, amprocrighttype,
@@ -11238,7 +11231,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo)
                        needComma = true;
                }
 
-               appendPQExpBuffer(q, ";\n");
+               appendPQExpBufferStr(q, ";\n");
        }
 
        appendPQExpBuffer(labelq, "OPERATOR FAMILY %s",
@@ -11329,9 +11322,9 @@ dumpCollation(Archive *fout, CollInfo *collinfo)
        appendPQExpBuffer(q, "CREATE COLLATION %s (lc_collate = ",
                                          fmtId(collinfo->dobj.name));
        appendStringLiteralAH(q, collcollate, fout);
-       appendPQExpBuffer(q, ", lc_ctype = ");
+       appendPQExpBufferStr(q, ", lc_ctype = ");
        appendStringLiteralAH(q, collctype, fout);
-       appendPQExpBuffer(q, ");\n");
+       appendPQExpBufferStr(q, ");\n");
 
        appendPQExpBuffer(labelq, "COLLATION %s", fmtId(collinfo->dobj.name));
 
@@ -11427,7 +11420,7 @@ dumpConversion(Archive *fout, ConvInfo *convinfo)
                                          (condefault) ? "DEFAULT " : "",
                                          fmtId(convinfo->dobj.name));
        appendStringLiteralAH(q, conforencoding, fout);
-       appendPQExpBuffer(q, " TO ");
+       appendPQExpBufferStr(q, " TO ");
        appendStringLiteralAH(q, contoencoding, fout);
        /* regproc is automatically quoted in 7.3 and above */
        appendPQExpBuffer(q, " FROM %s;\n", conproc);
@@ -11474,16 +11467,15 @@ format_aggregate_signature(AggInfo *agginfo, Archive *fout, bool honor_quotes)
 
        initPQExpBuffer(&buf);
        if (honor_quotes)
-               appendPQExpBuffer(&buf, "%s",
-                                                 fmtId(agginfo->aggfn.dobj.name));
+               appendPQExpBufferStr(&buf, fmtId(agginfo->aggfn.dobj.name));
        else
-               appendPQExpBuffer(&buf, "%s", agginfo->aggfn.dobj.name);
+               appendPQExpBufferStr(&buf, agginfo->aggfn.dobj.name);
 
        if (agginfo->aggfn.nargs == 0)
                appendPQExpBuffer(&buf, "(*)");
        else
        {
-               appendPQExpBuffer(&buf, "(");
+               appendPQExpBufferChar(&buf, '(');
                for (j = 0; j < agginfo->aggfn.nargs; j++)
                {
                        char       *typname;
@@ -11496,7 +11488,7 @@ format_aggregate_signature(AggInfo *agginfo, Archive *fout, bool honor_quotes)
                                                          typname);
                        free(typname);
                }
-               appendPQExpBuffer(&buf, ")");
+               appendPQExpBufferChar(&buf, ')');
        }
        return buf.data;
 }
@@ -11698,7 +11690,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
 
        if (!PQgetisnull(res, 0, i_agginitval))
        {
-               appendPQExpBuffer(details, ",\n    INITCOND = ");
+               appendPQExpBufferStr(details, ",\n    INITCOND = ");
                appendStringLiteralAH(details, agginitval, fout);
        }
 
@@ -11888,10 +11880,10 @@ dumpTSDictionary(Archive *fout, TSDictInfo *dictinfo)
        appendPQExpBuffer(q, "CREATE TEXT SEARCH DICTIONARY %s (\n",
                                          fmtId(dictinfo->dobj.name));
 
-       appendPQExpBuffer(q, "    TEMPLATE = ");
+       appendPQExpBufferStr(q, "    TEMPLATE = ");
        if (strcmp(nspname, dictinfo->dobj.namespace->dobj.name) != 0)
                appendPQExpBuffer(q, "%s.", fmtId(nspname));
-       appendPQExpBuffer(q, "%s", fmtId(tmplname));
+       appendPQExpBufferStr(q, fmtId(tmplname));
 
        PQclear(res);
 
@@ -11899,7 +11891,7 @@ dumpTSDictionary(Archive *fout, TSDictInfo *dictinfo)
        if (dictinfo->dictinitoption)
                appendPQExpBuffer(q, ",\n    %s", dictinfo->dictinitoption);
 
-       appendPQExpBuffer(q, " );\n");
+       appendPQExpBufferStr(q, " );\n");
 
        /*
         * DROP must be fully qualified in case same name appears in pg_catalog
@@ -12045,7 +12037,7 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo)
        appendPQExpBuffer(q, "CREATE TEXT SEARCH CONFIGURATION %s (\n",
                                          fmtId(cfginfo->dobj.name));
 
-       appendPQExpBuffer(q, "    PARSER = ");
+       appendPQExpBufferStr(q, "    PARSER = ");
        if (strcmp(nspname, cfginfo->dobj.namespace->dobj.name) != 0)
                appendPQExpBuffer(q, "%s.", fmtId(nspname));
        appendPQExpBuffer(q, "%s );\n", fmtId(prsname));
@@ -12079,7 +12071,7 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo)
                {
                        /* starting a new token type, so start a new command */
                        if (i > 0)
-                               appendPQExpBuffer(q, ";\n");
+                               appendPQExpBufferStr(q, ";\n");
                        appendPQExpBuffer(q, "\nALTER TEXT SEARCH CONFIGURATION %s\n",
                                                          fmtId(cfginfo->dobj.name));
                        /* tokenname needs quoting, dictname does NOT */
@@ -12091,7 +12083,7 @@ dumpTSConfig(Archive *fout, TSConfigInfo *cfginfo)
        }
 
        if (ntups > 0)
-               appendPQExpBuffer(q, ";\n");
+               appendPQExpBufferStr(q, ";\n");
 
        PQclear(res);
 
@@ -12172,7 +12164,7 @@ dumpForeignDataWrapper(Archive *fout, FdwInfo *fdwinfo)
        if (strlen(fdwinfo->fdwoptions) > 0)
                appendPQExpBuffer(q, " OPTIONS (\n    %s\n)", fdwinfo->fdwoptions);
 
-       appendPQExpBuffer(q, ";\n");
+       appendPQExpBufferStr(q, ";\n");
 
        appendPQExpBuffer(delq, "DROP FOREIGN DATA WRAPPER %s;\n",
                                          qfdwname);
@@ -12250,22 +12242,22 @@ dumpForeignServer(Archive *fout, ForeignServerInfo *srvinfo)
        appendPQExpBuffer(q, "CREATE SERVER %s", qsrvname);
        if (srvinfo->srvtype && strlen(srvinfo->srvtype) > 0)
        {
-               appendPQExpBuffer(q, " TYPE ");
+               appendPQExpBufferStr(q, " TYPE ");
                appendStringLiteralAH(q, srvinfo->srvtype, fout);
        }
        if (srvinfo->srvversion && strlen(srvinfo->srvversion) > 0)
        {
-               appendPQExpBuffer(q, " VERSION ");
+               appendPQExpBufferStr(q, " VERSION ");
                appendStringLiteralAH(q, srvinfo->srvversion, fout);
        }
 
-       appendPQExpBuffer(q, " FOREIGN DATA WRAPPER ");
-       appendPQExpBuffer(q, "%s", fmtId(fdwname));
+       appendPQExpBufferStr(q, " FOREIGN DATA WRAPPER ");
+       appendPQExpBufferStr(q, fmtId(fdwname));
 
        if (srvinfo->srvoptions && strlen(srvinfo->srvoptions) > 0)
                appendPQExpBuffer(q, " OPTIONS (\n    %s\n)", srvinfo->srvoptions);
 
-       appendPQExpBuffer(q, ";\n");
+       appendPQExpBufferStr(q, ";\n");
 
        appendPQExpBuffer(delq, "DROP SERVER %s;\n",
                                          qsrvname);
@@ -12382,7 +12374,7 @@ dumpUserMappings(Archive *fout,
                if (umoptions && strlen(umoptions) > 0)
                        appendPQExpBuffer(q, " OPTIONS (\n    %s\n)", umoptions);
 
-               appendPQExpBuffer(q, ";\n");
+               appendPQExpBufferStr(q, ";\n");
 
                resetPQExpBuffer(delq);
                appendPQExpBuffer(delq, "DROP USER MAPPING FOR %s", fmtId(usename));
@@ -12591,7 +12583,7 @@ dumpSecLabel(Archive *fout, const char *target,
                                                  "SECURITY LABEL FOR %s ON %s IS ",
                                                  fmtId(labels[i].provider), target);
                appendStringLiteralAH(query, labels[i].label, fout);
-               appendPQExpBuffer(query, ";\n");
+               appendPQExpBufferStr(query, ";\n");
        }
 
        if (query->len > 0)
@@ -12665,7 +12657,7 @@ dumpTableSecLabel(Archive *fout, TableInfo *tbinfo, const char *reltypename)
                appendPQExpBuffer(query, "SECURITY LABEL FOR %s ON %s IS ",
                                                  fmtId(provider), target->data);
                appendStringLiteralAH(query, label, fout);
-               appendPQExpBuffer(query, ";\n");
+               appendPQExpBufferStr(query, ";\n");
        }
        if (query->len > 0)
        {
@@ -12795,10 +12787,10 @@ collectSecLabels(Archive *fout, SecLabelItem **items)
 
        query = createPQExpBuffer();
 
-       appendPQExpBuffer(query,
-                                         "SELECT label, provider, classoid, objoid, objsubid "
-                                         "FROM pg_catalog.pg_seclabel "
-                                         "ORDER BY classoid, objoid, objsubid");
+       appendPQExpBufferStr(query,
+                                                "SELECT label, provider, classoid, objoid, objsubid "
+                                                "FROM pg_catalog.pg_seclabel "
+                                                "ORDER BY classoid, objoid, objsubid");
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -12921,8 +12913,8 @@ createViewAsClause(Archive *fout, TableInfo *tbinfo)
        }
        else
        {
-               appendPQExpBuffer(query, "SELECT definition AS viewdef "
-                                                 "FROM pg_views WHERE viewname = ");
+               appendPQExpBufferStr(query, "SELECT definition AS viewdef "
+                                                        "FROM pg_views WHERE viewname = ");
                appendStringLiteralAH(query, tbinfo->dobj.name, fout);
        }
 
@@ -13010,7 +13002,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
 
                if (tbinfo->checkoption != NULL)
                        appendPQExpBuffer(q, "\n  WITH %s CHECK OPTION", tbinfo->checkoption);
-               appendPQExpBuffer(q, ";\n");
+               appendPQExpBufferStr(q, ";\n");
 
                appendPQExpBuffer(labelq, "VIEW %s",
                                                  fmtId(tbinfo->dobj.name));
@@ -13129,15 +13121,14 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
 
                                        /* Format properly if not first attr */
                                        if (actual_atts == 0)
-                                               appendPQExpBuffer(q, " (");
+                                               appendPQExpBufferStr(q, " (");
                                        else
-                                               appendPQExpBuffer(q, ",");
-                                       appendPQExpBuffer(q, "\n    ");
+                                               appendPQExpBufferStr(q, ",");
+                                       appendPQExpBufferStr(q, "\n    ");
                                        actual_atts++;
 
                                        /* Attribute name */
-                                       appendPQExpBuffer(q, "%s",
-                                                                         fmtId(tbinfo->attnames[j]));
+                                       appendPQExpBufferStr(q, fmtId(tbinfo->attnames[j]));
 
                                        if (tbinfo->attisdropped[j])
                                        {
@@ -13147,7 +13138,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
                                                 * valid type name; insert INTEGER as a stopgap. We'll
                                                 * clean things up later.
                                                 */
-                                               appendPQExpBuffer(q, " INTEGER /* dummy */");
+                                               appendPQExpBufferStr(q, " INTEGER /* dummy */");
                                                /* Skip all the rest, too */
                                                continue;
                                        }
@@ -13155,7 +13146,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
                                        /* Attribute type */
                                        if (tbinfo->reloftype && !binary_upgrade)
                                        {
-                                               appendPQExpBuffer(q, " WITH OPTIONS");
+                                               appendPQExpBufferStr(q, " WITH OPTIONS");
                                        }
                                        else if (fout->remoteVersion >= 70100)
                                        {
@@ -13181,8 +13172,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
                                                        /* always schema-qualify, don't try to be smart */
                                                        appendPQExpBuffer(q, " COLLATE %s.",
                                                                         fmtId(coll->dobj.namespace->dobj.name));
-                                                       appendPQExpBuffer(q, "%s",
-                                                                                         fmtId(coll->dobj.name));
+                                                       appendPQExpBufferStr(q, fmtId(coll->dobj.name));
                                                }
                                        }
 
@@ -13191,7 +13181,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
                                                                                  tbinfo->attrdefs[j]->adef_expr);
 
                                        if (has_notnull)
-                                               appendPQExpBuffer(q, " NOT NULL");
+                                               appendPQExpBufferStr(q, " NOT NULL");
                                }
                        }
 
@@ -13206,44 +13196,43 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
                                        continue;
 
                                if (actual_atts == 0)
-                                       appendPQExpBuffer(q, " (\n    ");
+                                       appendPQExpBufferStr(q, " (\n    ");
                                else
-                                       appendPQExpBuffer(q, ",\n    ");
+                                       appendPQExpBufferStr(q, ",\n    ");
 
                                appendPQExpBuffer(q, "CONSTRAINT %s ",
                                                                  fmtId(constr->dobj.name));
-                               appendPQExpBuffer(q, "%s", constr->condef);
+                               appendPQExpBufferStr(q, constr->condef);
 
                                actual_atts++;
                        }
 
                        if (actual_atts)
-                               appendPQExpBuffer(q, "\n)");
+                               appendPQExpBufferStr(q, "\n)");
                        else if (!(tbinfo->reloftype && !binary_upgrade))
                        {
                                /*
                                 * We must have a parenthesized attribute list, even though
                                 * empty, when not using the OF TYPE syntax.
                                 */
-                               appendPQExpBuffer(q, " (\n)");
+                               appendPQExpBufferStr(q, " (\n)");
                        }
 
                        if (numParents > 0 && !binary_upgrade)
                        {
-                               appendPQExpBuffer(q, "\nINHERITS (");
+                               appendPQExpBufferStr(q, "\nINHERITS (");
                                for (k = 0; k < numParents; k++)
                                {
                                        TableInfo  *parentRel = parents[k];
 
                                        if (k > 0)
-                                               appendPQExpBuffer(q, ", ");
+                                               appendPQExpBufferStr(q, ", ");
                                        if (parentRel->dobj.namespace != tbinfo->dobj.namespace)
                                                appendPQExpBuffer(q, "%s.",
                                                                fmtId(parentRel->dobj.namespace->dobj.name));
-                                       appendPQExpBuffer(q, "%s",
-                                                                         fmtId(parentRel->dobj.name));
+                                       appendPQExpBufferStr(q, fmtId(parentRel->dobj.name));
                                }
-                               appendPQExpBuffer(q, ")");
+                               appendPQExpBufferChar(q, ')');
                        }
 
                        if (tbinfo->relkind == RELKIND_FOREIGN_TABLE)
@@ -13255,18 +13244,18 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
                {
                        bool            addcomma = false;
 
-                       appendPQExpBuffer(q, "\nWITH (");
+                       appendPQExpBufferStr(q, "\nWITH (");
                        if (tbinfo->reloptions && strlen(tbinfo->reloptions) > 0)
                        {
                                addcomma = true;
-                               appendPQExpBuffer(q, "%s", tbinfo->reloptions);
+                               appendPQExpBufferStr(q, tbinfo->reloptions);
                        }
                        if (tbinfo->toast_reloptions && strlen(tbinfo->toast_reloptions) > 0)
                        {
                                appendPQExpBuffer(q, "%s%s", addcomma ? ", " : "",
                                                                  tbinfo->toast_reloptions);
                        }
-                       appendPQExpBuffer(q, ")");
+                       appendPQExpBufferChar(q, ')');
                }
 
                /* Dump generic options if any */
@@ -13287,7 +13276,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
                        destroyPQExpBuffer(result);
                }
                else
-                       appendPQExpBuffer(q, ";\n");
+                       appendPQExpBufferStr(q, ";\n");
 
                /*
                 * To create binary-compatible heap files, we have to ensure the same
@@ -13309,7 +13298,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
                        {
                                if (tbinfo->attisdropped[j])
                                {
-                                       appendPQExpBuffer(q, "\n-- For binary upgrade, recreate dropped column.\n");
+                                       appendPQExpBufferStr(q, "\n-- For binary upgrade, recreate dropped column.\n");
                                        appendPQExpBuffer(q, "UPDATE pg_catalog.pg_attribute\n"
                                                                          "SET attlen = %d, "
                                                                          "attalign = '%c', attbyval = false\n"
@@ -13317,9 +13306,9 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
                                                                          tbinfo->attlen[j],
                                                                          tbinfo->attalign[j]);
                                        appendStringLiteralAH(q, tbinfo->attnames[j], fout);
-                                       appendPQExpBuffer(q, "\n  AND attrelid = ");
+                                       appendPQExpBufferStr(q, "\n  AND attrelid = ");
                                        appendStringLiteralAH(q, fmtId(tbinfo->dobj.name), fout);
-                                       appendPQExpBuffer(q, "::pg_catalog.regclass;\n");
+                                       appendPQExpBufferStr(q, "::pg_catalog.regclass;\n");
 
                                        if (tbinfo->relkind == RELKIND_RELATION)
                                                appendPQExpBuffer(q, "ALTER TABLE ONLY %s ",
@@ -13334,14 +13323,14 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
                                else if (!tbinfo->attislocal[j])
                                {
                                        Assert(tbinfo->relkind != RELKIND_FOREIGN_TABLE);
-                                       appendPQExpBuffer(q, "\n-- For binary upgrade, recreate inherited column.\n");
-                                       appendPQExpBuffer(q, "UPDATE pg_catalog.pg_attribute\n"
+                                       appendPQExpBufferStr(q, "\n-- For binary upgrade, recreate inherited column.\n");
+                                       appendPQExpBufferStr(q, "UPDATE pg_catalog.pg_attribute\n"
                                                                          "SET attislocal = false\n"
                                                                          "WHERE attname = ");
                                        appendStringLiteralAH(q, tbinfo->attnames[j], fout);
-                                       appendPQExpBuffer(q, "\n  AND attrelid = ");
+                                       appendPQExpBufferStr(q, "\n  AND attrelid = ");
                                        appendStringLiteralAH(q, fmtId(tbinfo->dobj.name), fout);
-                                       appendPQExpBuffer(q, "::pg_catalog.regclass;\n");
+                                       appendPQExpBufferStr(q, "::pg_catalog.regclass;\n");
                                }
                        }
 
@@ -13352,24 +13341,24 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
                                if (constr->separate || constr->conislocal)
                                        continue;
 
-                               appendPQExpBuffer(q, "\n-- For binary upgrade, set up inherited constraint.\n");
+                               appendPQExpBufferStr(q, "\n-- For binary upgrade, set up inherited constraint.\n");
                                appendPQExpBuffer(q, "ALTER TABLE ONLY %s ",
                                                                  fmtId(tbinfo->dobj.name));
                                appendPQExpBuffer(q, " ADD CONSTRAINT %s ",
                                                                  fmtId(constr->dobj.name));
                                appendPQExpBuffer(q, "%s;\n", constr->condef);
-                               appendPQExpBuffer(q, "UPDATE pg_catalog.pg_constraint\n"
+                               appendPQExpBufferStr(q, "UPDATE pg_catalog.pg_constraint\n"
                                                                  "SET conislocal = false\n"
                                                                  "WHERE contype = 'c' AND conname = ");
                                appendStringLiteralAH(q, constr->dobj.name, fout);
-                               appendPQExpBuffer(q, "\n  AND conrelid = ");
+                               appendPQExpBufferStr(q, "\n  AND conrelid = ");
                                appendStringLiteralAH(q, fmtId(tbinfo->dobj.name), fout);
-                               appendPQExpBuffer(q, "::pg_catalog.regclass;\n");
+                               appendPQExpBufferStr(q, "::pg_catalog.regclass;\n");
                        }
 
                        if (numParents > 0)
                        {
-                               appendPQExpBuffer(q, "\n-- For binary upgrade, set up inheritance this way.\n");
+                               appendPQExpBufferStr(q, "\n-- For binary upgrade, set up inheritance this way.\n");
                                for (k = 0; k < numParents; k++)
                                {
                                        TableInfo  *parentRel = parents[k];
@@ -13386,24 +13375,24 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
 
                        if (tbinfo->reloftype)
                        {
-                               appendPQExpBuffer(q, "\n-- For binary upgrade, set up typed tables this way.\n");
+                               appendPQExpBufferStr(q, "\n-- For binary upgrade, set up typed tables this way.\n");
                                appendPQExpBuffer(q, "ALTER TABLE ONLY %s OF %s;\n",
                                                                  fmtId(tbinfo->dobj.name),
                                                                  tbinfo->reloftype);
                        }
 
-                       appendPQExpBuffer(q, "\n-- For binary upgrade, set heap's relfrozenxid\n");
+                       appendPQExpBufferStr(q, "\n-- For binary upgrade, set heap's relfrozenxid\n");
                        appendPQExpBuffer(q, "UPDATE pg_catalog.pg_class\n"
                                                          "SET relfrozenxid = '%u'\n"
                                                          "WHERE oid = ",
                                                          tbinfo->frozenxid);
                        appendStringLiteralAH(q, fmtId(tbinfo->dobj.name), fout);
-                       appendPQExpBuffer(q, "::pg_catalog.regclass;\n");
+                       appendPQExpBufferStr(q, "::pg_catalog.regclass;\n");
 
                        if (tbinfo->toast_oid)
                        {
                                /* We preserve the toast oids, so we can use it during restore */
-                               appendPQExpBuffer(q, "\n-- For binary upgrade, set toast's relfrozenxid\n");
+                               appendPQExpBufferStr(q, "\n-- For binary upgrade, set toast's relfrozenxid\n");
                                appendPQExpBuffer(q, "UPDATE pg_catalog.pg_class\n"
                                                                  "SET relfrozenxid = '%u'\n"
                                                                  "WHERE oid = '%u';\n",
@@ -13420,12 +13409,12 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
                if (binary_upgrade && tbinfo->relkind == RELKIND_MATVIEW &&
                        tbinfo->relispopulated)
                {
-                       appendPQExpBuffer(q, "\n-- For binary upgrade, mark materialized view as populated\n");
-                       appendPQExpBuffer(q, "UPDATE pg_catalog.pg_class\n"
+                       appendPQExpBufferStr(q, "\n-- For binary upgrade, mark materialized view as populated\n");
+                       appendPQExpBufferStr(q, "UPDATE pg_catalog.pg_class\n"
                                                          "SET relispopulated = 't'\n"
                                                          "WHERE oid = ");
                        appendStringLiteralAH(q, fmtId(tbinfo->dobj.name), fout);
-                       appendPQExpBuffer(q, "::pg_catalog.regclass;\n");
+                       appendPQExpBufferStr(q, "::pg_catalog.regclass;\n");
                }
 
                /*
@@ -13834,19 +13823,19 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo)
                                                                  fmtId(attname));
                        }
 
-                       appendPQExpBuffer(q, ")");
+                       appendPQExpBufferChar(q, ')');
 
                        if (indxinfo->options && strlen(indxinfo->options) > 0)
                                appendPQExpBuffer(q, " WITH (%s)", indxinfo->options);
 
                        if (coninfo->condeferrable)
                        {
-                               appendPQExpBuffer(q, " DEFERRABLE");
+                               appendPQExpBufferStr(q, " DEFERRABLE");
                                if (coninfo->condeferred)
-                                       appendPQExpBuffer(q, " INITIALLY DEFERRED");
+                                       appendPQExpBufferStr(q, " INITIALLY DEFERRED");
                        }
 
-                       appendPQExpBuffer(q, ";\n");
+                       appendPQExpBufferStr(q, ";\n");
                }
 
                /* If the index is clustered, we need to record that. */
@@ -14039,7 +14028,7 @@ findLastBuiltinOid_V71(Archive *fout, const char *dbname)
        PQExpBuffer query = createPQExpBuffer();
 
        resetPQExpBuffer(query);
-       appendPQExpBuffer(query, "SELECT datlastsysoid from pg_database where datname = ");
+       appendPQExpBufferStr(query, "SELECT datlastsysoid from pg_database where datname = ");
        appendStringLiteralAH(query, dbname, fout);
 
        res = ExecuteSqlQueryForSingleRow(fout, query->data);
@@ -14191,18 +14180,18 @@ dumpSequence(Archive *fout, TableInfo *tbinfo)
        if (minv)
                appendPQExpBuffer(query, "    MINVALUE %s\n", minv);
        else
-               appendPQExpBuffer(query, "    NO MINVALUE\n");
+               appendPQExpBufferStr(query, "    NO MINVALUE\n");
 
        if (maxv)
                appendPQExpBuffer(query, "    MAXVALUE %s\n", maxv);
        else
-               appendPQExpBuffer(query, "    NO MAXVALUE\n");
+               appendPQExpBufferStr(query, "    NO MAXVALUE\n");
 
        appendPQExpBuffer(query,
                                          "    CACHE %s%s",
                                          cache, (cycled ? "\n    CYCLE" : ""));
 
-       appendPQExpBuffer(query, ";\n");
+       appendPQExpBufferStr(query, ";\n");
 
        appendPQExpBuffer(labelq, "SEQUENCE %s", fmtId(tbinfo->dobj.name));
 
@@ -14310,7 +14299,7 @@ dumpSequenceData(Archive *fout, TableDataInfo *tdinfo)
        called = (strcmp(PQgetvalue(res, 0, 1), "t") == 0);
 
        resetPQExpBuffer(query);
-       appendPQExpBuffer(query, "SELECT pg_catalog.setval(");
+       appendPQExpBufferStr(query, "SELECT pg_catalog.setval(");
        appendStringLiteralAH(query, fmtId(tbinfo->dobj.name), fout);
        appendPQExpBuffer(query, ", %s, %s);\n",
                                          last, (called ? "true" : "false"));
@@ -14367,23 +14356,23 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo)
        {
                if (tginfo->tgisconstraint)
                {
-                       appendPQExpBuffer(query, "CREATE CONSTRAINT TRIGGER ");
+                       appendPQExpBufferStr(query, "CREATE CONSTRAINT TRIGGER ");
                        appendPQExpBufferStr(query, fmtId(tginfo->tgconstrname));
                }
                else
                {
-                       appendPQExpBuffer(query, "CREATE TRIGGER ");
+                       appendPQExpBufferStr(query, "CREATE TRIGGER ");
                        appendPQExpBufferStr(query, fmtId(tginfo->dobj.name));
                }
-               appendPQExpBuffer(query, "\n    ");
+               appendPQExpBufferStr(query, "\n    ");
 
                /* Trigger type */
                if (TRIGGER_FOR_BEFORE(tginfo->tgtype))
-                       appendPQExpBuffer(query, "BEFORE");
+                       appendPQExpBufferStr(query, "BEFORE");
                else if (TRIGGER_FOR_AFTER(tginfo->tgtype))
-                       appendPQExpBuffer(query, "AFTER");
+                       appendPQExpBufferStr(query, "AFTER");
                else if (TRIGGER_FOR_INSTEAD(tginfo->tgtype))
-                       appendPQExpBuffer(query, "INSTEAD OF");
+                       appendPQExpBufferStr(query, "INSTEAD OF");
                else
                {
                        write_msg(NULL, "unexpected tgtype value: %d\n", tginfo->tgtype);
@@ -14393,31 +14382,31 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo)
                findx = 0;
                if (TRIGGER_FOR_INSERT(tginfo->tgtype))
                {
-                       appendPQExpBuffer(query, " INSERT");
+                       appendPQExpBufferStr(query, " INSERT");
                        findx++;
                }
                if (TRIGGER_FOR_DELETE(tginfo->tgtype))
                {
                        if (findx > 0)
-                               appendPQExpBuffer(query, " OR DELETE");
+                               appendPQExpBufferStr(query, " OR DELETE");
                        else
-                               appendPQExpBuffer(query, " DELETE");
+                               appendPQExpBufferStr(query, " DELETE");
                        findx++;
                }
                if (TRIGGER_FOR_UPDATE(tginfo->tgtype))
                {
                        if (findx > 0)
-                               appendPQExpBuffer(query, " OR UPDATE");
+                               appendPQExpBufferStr(query, " OR UPDATE");
                        else
-                               appendPQExpBuffer(query, " UPDATE");
+                               appendPQExpBufferStr(query, " UPDATE");
                        findx++;
                }
                if (TRIGGER_FOR_TRUNCATE(tginfo->tgtype))
                {
                        if (findx > 0)
-                               appendPQExpBuffer(query, " OR TRUNCATE");
+                               appendPQExpBufferStr(query, " OR TRUNCATE");
                        else
-                               appendPQExpBuffer(query, " TRUNCATE");
+                               appendPQExpBufferStr(query, " TRUNCATE");
                        findx++;
                }
                appendPQExpBuffer(query, " ON %s\n",
@@ -14436,18 +14425,18 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo)
                                                                          fmtId(tginfo->tgconstrrelname));
                        }
                        if (!tginfo->tgdeferrable)
-                               appendPQExpBuffer(query, "NOT ");
-                       appendPQExpBuffer(query, "DEFERRABLE INITIALLY ");
+                               appendPQExpBufferStr(query, "NOT ");
+                       appendPQExpBufferStr(query, "DEFERRABLE INITIALLY ");
                        if (tginfo->tginitdeferred)
-                               appendPQExpBuffer(query, "DEFERRED\n");
+                               appendPQExpBufferStr(query, "DEFERRED\n");
                        else
-                               appendPQExpBuffer(query, "IMMEDIATE\n");
+                               appendPQExpBufferStr(query, "IMMEDIATE\n");
                }
 
                if (TRIGGER_FOR_ROW(tginfo->tgtype))
-                       appendPQExpBuffer(query, "    FOR EACH ROW\n    ");
+                       appendPQExpBufferStr(query, "    FOR EACH ROW\n    ");
                else
-                       appendPQExpBuffer(query, "    FOR EACH STATEMENT\n    ");
+                       appendPQExpBufferStr(query, "    FOR EACH STATEMENT\n    ");
 
                /* In 7.3, result of regproc is already quoted */
                if (fout->remoteVersion >= 70300)
@@ -14476,12 +14465,12 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo)
                        }
 
                        if (findx > 0)
-                               appendPQExpBuffer(query, ", ");
+                               appendPQExpBufferStr(query, ", ");
                        appendStringLiteralAH(query, p, fout);
                        p += tlen + 1;
                }
                free(tgargs);
-               appendPQExpBuffer(query, ");\n");
+               appendPQExpBufferStr(query, ");\n");
        }
 
        if (tginfo->tgenabled != 't' && tginfo->tgenabled != 'O')
@@ -14492,16 +14481,16 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo)
                {
                        case 'D':
                        case 'f':
-                               appendPQExpBuffer(query, "DISABLE");
+                               appendPQExpBufferStr(query, "DISABLE");
                                break;
                        case 'A':
-                               appendPQExpBuffer(query, "ENABLE ALWAYS");
+                               appendPQExpBufferStr(query, "ENABLE ALWAYS");
                                break;
                        case 'R':
-                               appendPQExpBuffer(query, "ENABLE REPLICA");
+                               appendPQExpBufferStr(query, "ENABLE REPLICA");
                                break;
                        default:
-                               appendPQExpBuffer(query, "ENABLE");
+                               appendPQExpBufferStr(query, "ENABLE");
                                break;
                }
                appendPQExpBuffer(query, " TRIGGER %s;\n",
@@ -14541,9 +14530,9 @@ dumpEventTrigger(Archive *fout, EventTriggerInfo *evtinfo)
        query = createPQExpBuffer();
        labelq = createPQExpBuffer();
 
-       appendPQExpBuffer(query, "CREATE EVENT TRIGGER ");
+       appendPQExpBufferStr(query, "CREATE EVENT TRIGGER ");
        appendPQExpBufferStr(query, fmtId(evtinfo->dobj.name));
-       appendPQExpBuffer(query, " ON ");
+       appendPQExpBufferStr(query, " ON ");
        appendPQExpBufferStr(query, fmtId(evtinfo->evtevent));
        appendPQExpBufferStr(query, " ");
 
@@ -14554,9 +14543,9 @@ dumpEventTrigger(Archive *fout, EventTriggerInfo *evtinfo)
                appendPQExpBufferStr(query, ") ");
        }
 
-       appendPQExpBuffer(query, "\n   EXECUTE PROCEDURE ");
+       appendPQExpBufferStr(query, "\n   EXECUTE PROCEDURE ");
        appendPQExpBufferStr(query, evtinfo->evtfname);
-       appendPQExpBuffer(query, "();\n");
+       appendPQExpBufferStr(query, "();\n");
 
        if (evtinfo->evtenabled != 'O')
        {
@@ -14565,19 +14554,19 @@ dumpEventTrigger(Archive *fout, EventTriggerInfo *evtinfo)
                switch (evtinfo->evtenabled)
                {
                        case 'D':
-                               appendPQExpBuffer(query, "DISABLE");
+                               appendPQExpBufferStr(query, "DISABLE");
                                break;
                        case 'A':
-                               appendPQExpBuffer(query, "ENABLE ALWAYS");
+                               appendPQExpBufferStr(query, "ENABLE ALWAYS");
                                break;
                        case 'R':
-                               appendPQExpBuffer(query, "ENABLE REPLICA");
+                               appendPQExpBufferStr(query, "ENABLE REPLICA");
                                break;
                        default:
-                               appendPQExpBuffer(query, "ENABLE");
+                               appendPQExpBufferStr(query, "ENABLE");
                                break;
                }
-               appendPQExpBuffer(query, ";\n");
+               appendPQExpBufferStr(query, ";\n");
        }
        appendPQExpBuffer(labelq, "EVENT TRIGGER %s ",
                                          fmtId(evtinfo->dobj.name));
@@ -14756,12 +14745,12 @@ getExtensionMembership(Archive *fout, ExtensionInfo extinfo[],
        query = createPQExpBuffer();
 
        /* refclassid constraint is redundant but may speed the search */
-       appendPQExpBuffer(query, "SELECT "
-                                         "classid, objid, refclassid, refobjid "
-                                         "FROM pg_depend "
-                                         "WHERE refclassid = 'pg_extension'::regclass "
-                                         "AND deptype = 'e' "
-                                         "ORDER BY 3,4");
+       appendPQExpBufferStr(query, "SELECT "
+                                                "classid, objid, refclassid, refobjid "
+                                                "FROM pg_depend "
+                                                "WHERE refclassid = 'pg_extension'::regclass "
+                                                "AND deptype = 'e' "
+                                                "ORDER BY 3,4");
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -14960,11 +14949,11 @@ getDependencies(Archive *fout)
         * PIN dependencies aren't interesting, and EXTENSION dependencies were
         * already processed by getExtensionMembership.
         */
-       appendPQExpBuffer(query, "SELECT "
-                                         "classid, objid, refclassid, refobjid, deptype "
-                                         "FROM pg_depend "
-                                         "WHERE deptype != 'p' AND deptype != 'e' "
-                                         "ORDER BY 1,2");
+       appendPQExpBufferStr(query, "SELECT "
+                                                "classid, objid, refclassid, refobjid, deptype "
+                                                "FROM pg_depend "
+                                                "WHERE deptype != 'p' AND deptype != 'e' "
+                                                "ORDER BY 1,2");
 
        res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
 
@@ -15304,7 +15293,7 @@ selectSourceSchema(Archive *fout, const char *schemaName)
        appendPQExpBuffer(query, "SET search_path = %s",
                                          fmtId(schemaName));
        if (strcmp(schemaName, "pg_catalog") != 0)
-               appendPQExpBuffer(query, ", pg_catalog");
+               appendPQExpBufferStr(query, ", pg_catalog");
 
        ExecuteSqlStatement(fout, query->data);
 
@@ -15397,21 +15386,21 @@ myFormatType(const char *typname, int32 typmod)
        {
                int                     len = (typmod - VARHDRSZ);
 
-               appendPQExpBuffer(buf, "character");
+               appendPQExpBufferStr(buf, "character");
                if (len > 1)
                        appendPQExpBuffer(buf, "(%d)",
                                                          typmod - VARHDRSZ);
        }
        else if (strcmp(typname, "varchar") == 0)
        {
-               appendPQExpBuffer(buf, "character varying");
+               appendPQExpBufferStr(buf, "character varying");
                if (typmod != -1)
                        appendPQExpBuffer(buf, "(%d)",
                                                          typmod - VARHDRSZ);
        }
        else if (strcmp(typname, "numeric") == 0)
        {
-               appendPQExpBuffer(buf, "numeric");
+               appendPQExpBufferStr(buf, "numeric");
                if (typmod != -1)
                {
                        int32           tmp_typmod;
@@ -15431,13 +15420,13 @@ myFormatType(const char *typname, int32 typmod)
         * through with quotes. - thomas 1998-12-13
         */
        else if (strcmp(typname, "char") == 0)
-               appendPQExpBuffer(buf, "\"char\"");
+               appendPQExpBufferStr(buf, "\"char\"");
        else
-               appendPQExpBuffer(buf, "%s", fmtId(typname));
+               appendPQExpBufferStr(buf, fmtId(typname));
 
        /* Append array qualifier for array types */
        if (isarray)
-               appendPQExpBuffer(buf, "[]");
+               appendPQExpBufferStr(buf, "[]");
 
        result = pg_strdup(buf->data);
        destroyPQExpBuffer(buf);
@@ -15460,22 +15449,22 @@ fmtCopyColumnList(const TableInfo *ti, PQExpBuffer buffer)
        bool            needComma;
        int                     i;
 
-       appendPQExpBuffer(buffer, "(");
+       appendPQExpBufferChar(buffer, '(');
        needComma = false;
        for (i = 0; i < numatts; i++)
        {
                if (attisdropped[i])
                        continue;
                if (needComma)
-                       appendPQExpBuffer(buffer, ", ");
-               appendPQExpBuffer(buffer, "%s", fmtId(attnames[i]));
+                       appendPQExpBufferStr(buffer, ", ");
+               appendPQExpBufferStr(buffer, fmtId(attnames[i]));
                needComma = true;
        }
 
        if (!needComma)
                return "";                              /* no undropped columns */
 
-       appendPQExpBuffer(buffer, ")");
+       appendPQExpBufferChar(buffer, ')');
        return buffer->data;
 }
 
index 615dd48f5771dc750d999bdf7c211d7778caeb09..336ae588c7de13e92b026490661e10e8eba5db6e 100644 (file)
@@ -199,7 +199,7 @@ main(int argc, char *argv[])
                {
                        case 'a':
                                data_only = true;
-                               appendPQExpBuffer(pgdumpopts, " -a");
+                               appendPQExpBufferStr(pgdumpopts, " -a");
                                break;
 
                        case 'c':
@@ -212,7 +212,7 @@ main(int argc, char *argv[])
 
                        case 'f':
                                filename = pg_strdup(optarg);
-                               appendPQExpBuffer(pgdumpopts, " -f ");
+                               appendPQExpBufferStr(pgdumpopts, " -f ");
                                doShellQuoting(pgdumpopts, filename);
                                break;
 
@@ -233,11 +233,11 @@ main(int argc, char *argv[])
                                break;
 
                        case 'o':
-                               appendPQExpBuffer(pgdumpopts, " -o");
+                               appendPQExpBufferStr(pgdumpopts, " -o");
                                break;
 
                        case 'O':
-                               appendPQExpBuffer(pgdumpopts, " -O");
+                               appendPQExpBufferStr(pgdumpopts, " -O");
                                break;
 
                        case 'p':
@@ -249,11 +249,11 @@ main(int argc, char *argv[])
                                break;
 
                        case 's':
-                               appendPQExpBuffer(pgdumpopts, " -s");
+                               appendPQExpBufferStr(pgdumpopts, " -s");
                                break;
 
                        case 'S':
-                               appendPQExpBuffer(pgdumpopts, " -S ");
+                               appendPQExpBufferStr(pgdumpopts, " -S ");
                                doShellQuoting(pgdumpopts, optarg);
                                break;
 
@@ -267,35 +267,35 @@ main(int argc, char *argv[])
 
                        case 'v':
                                verbose = true;
-                               appendPQExpBuffer(pgdumpopts, " -v");
+                               appendPQExpBufferStr(pgdumpopts, " -v");
                                break;
 
                        case 'w':
                                prompt_password = TRI_NO;
-                               appendPQExpBuffer(pgdumpopts, " -w");
+                               appendPQExpBufferStr(pgdumpopts, " -w");
                                break;
 
                        case 'W':
                                prompt_password = TRI_YES;
-                               appendPQExpBuffer(pgdumpopts, " -W");
+                               appendPQExpBufferStr(pgdumpopts, " -W");
                                break;
 
                        case 'x':
                                skip_acls = true;
-                               appendPQExpBuffer(pgdumpopts, " -x");
+                               appendPQExpBufferStr(pgdumpopts, " -x");
                                break;
 
                        case 0:
                                break;
 
                        case 2:
-                               appendPQExpBuffer(pgdumpopts, " --lock-wait-timeout ");
+                               appendPQExpBufferStr(pgdumpopts, " --lock-wait-timeout ");
                                doShellQuoting(pgdumpopts, optarg);
                                break;
 
                        case 3:
                                use_role = pg_strdup(optarg);
-                               appendPQExpBuffer(pgdumpopts, " --role ");
+                               appendPQExpBufferStr(pgdumpopts, " --role ");
                                doShellQuoting(pgdumpopts, use_role);
                                break;
 
@@ -345,25 +345,25 @@ main(int argc, char *argv[])
 
        /* Add long options to the pg_dump argument list */
        if (binary_upgrade)
-               appendPQExpBuffer(pgdumpopts, " --binary-upgrade");
+               appendPQExpBufferStr(pgdumpopts, " --binary-upgrade");
        if (column_inserts)
-               appendPQExpBuffer(pgdumpopts, " --column-inserts");
+               appendPQExpBufferStr(pgdumpopts, " --column-inserts");
        if (disable_dollar_quoting)
-               appendPQExpBuffer(pgdumpopts, " --disable-dollar-quoting");
+               appendPQExpBufferStr(pgdumpopts, " --disable-dollar-quoting");
        if (disable_triggers)
-               appendPQExpBuffer(pgdumpopts, " --disable-triggers");
+               appendPQExpBufferStr(pgdumpopts, " --disable-triggers");
        if (inserts)
-               appendPQExpBuffer(pgdumpopts, " --inserts");
+               appendPQExpBufferStr(pgdumpopts, " --inserts");
        if (no_tablespaces)
-               appendPQExpBuffer(pgdumpopts, " --no-tablespaces");
+               appendPQExpBufferStr(pgdumpopts, " --no-tablespaces");
        if (quote_all_identifiers)
-               appendPQExpBuffer(pgdumpopts, " --quote-all-identifiers");
+               appendPQExpBufferStr(pgdumpopts, " --quote-all-identifiers");
        if (use_setsessauth)
-               appendPQExpBuffer(pgdumpopts, " --use-set-session-authorization");
+               appendPQExpBufferStr(pgdumpopts, " --use-set-session-authorization");
        if (no_security_labels)
-               appendPQExpBuffer(pgdumpopts, " --no-security-labels");
+               appendPQExpBufferStr(pgdumpopts, " --no-security-labels");
        if (no_unlogged_table_data)
-               appendPQExpBuffer(pgdumpopts, " --no-unlogged-table-data");
+               appendPQExpBufferStr(pgdumpopts, " --no-unlogged-table-data");
 
        /*
         * If there was a database specified on the command line, use that,
@@ -746,7 +746,7 @@ dumpRoles(PGconn *conn)
 
                if (binary_upgrade)
                {
-                       appendPQExpBuffer(buf, "\n-- For binary upgrade, must preserve pg_authid.oid\n");
+                       appendPQExpBufferStr(buf, "\n-- For binary upgrade, must preserve pg_authid.oid\n");
                        appendPQExpBuffer(buf,
                                                          "SELECT binary_upgrade.set_next_pg_authid_oid('%u'::pg_catalog.oid);\n\n",
                                                          auth_oid);
@@ -766,34 +766,34 @@ dumpRoles(PGconn *conn)
                appendPQExpBuffer(buf, "ALTER ROLE %s WITH", fmtId(rolename));
 
                if (strcmp(PQgetvalue(res, i, i_rolsuper), "t") == 0)
-                       appendPQExpBuffer(buf, " SUPERUSER");
+                       appendPQExpBufferStr(buf, " SUPERUSER");
                else
-                       appendPQExpBuffer(buf, " NOSUPERUSER");
+                       appendPQExpBufferStr(buf, " NOSUPERUSER");
 
                if (strcmp(PQgetvalue(res, i, i_rolinherit), "t") == 0)
-                       appendPQExpBuffer(buf, " INHERIT");
+                       appendPQExpBufferStr(buf, " INHERIT");
                else
-                       appendPQExpBuffer(buf, " NOINHERIT");
+                       appendPQExpBufferStr(buf, " NOINHERIT");
 
                if (strcmp(PQgetvalue(res, i, i_rolcreaterole), "t") == 0)
-                       appendPQExpBuffer(buf, " CREATEROLE");
+                       appendPQExpBufferStr(buf, " CREATEROLE");
                else
-                       appendPQExpBuffer(buf, " NOCREATEROLE");
+                       appendPQExpBufferStr(buf, " NOCREATEROLE");
 
                if (strcmp(PQgetvalue(res, i, i_rolcreatedb), "t") == 0)
-                       appendPQExpBuffer(buf, " CREATEDB");
+                       appendPQExpBufferStr(buf, " CREATEDB");
                else
-                       appendPQExpBuffer(buf, " NOCREATEDB");
+                       appendPQExpBufferStr(buf, " NOCREATEDB");
 
                if (strcmp(PQgetvalue(res, i, i_rolcanlogin), "t") == 0)
-                       appendPQExpBuffer(buf, " LOGIN");
+                       appendPQExpBufferStr(buf, " LOGIN");
                else
-                       appendPQExpBuffer(buf, " NOLOGIN");
+                       appendPQExpBufferStr(buf, " NOLOGIN");
 
                if (strcmp(PQgetvalue(res, i, i_rolreplication), "t") == 0)
-                       appendPQExpBuffer(buf, " REPLICATION");
+                       appendPQExpBufferStr(buf, " REPLICATION");
                else
-                       appendPQExpBuffer(buf, " NOREPLICATION");
+                       appendPQExpBufferStr(buf, " NOREPLICATION");
 
                if (strcmp(PQgetvalue(res, i, i_rolconnlimit), "-1") != 0)
                        appendPQExpBuffer(buf, " CONNECTION LIMIT %s",
@@ -801,7 +801,7 @@ dumpRoles(PGconn *conn)
 
                if (!PQgetisnull(res, i, i_rolpassword))
                {
-                       appendPQExpBuffer(buf, " PASSWORD ");
+                       appendPQExpBufferStr(buf, " PASSWORD ");
                        appendStringLiteralConn(buf, PQgetvalue(res, i, i_rolpassword), conn);
                }
 
@@ -809,13 +809,13 @@ dumpRoles(PGconn *conn)
                        appendPQExpBuffer(buf, " VALID UNTIL '%s'",
                                                          PQgetvalue(res, i, i_rolvaliduntil));
 
-               appendPQExpBuffer(buf, ";\n");
+               appendPQExpBufferStr(buf, ";\n");
 
                if (!PQgetisnull(res, i, i_rolcomment))
                {
                        appendPQExpBuffer(buf, "COMMENT ON ROLE %s IS ", fmtId(rolename));
                        appendStringLiteralConn(buf, PQgetvalue(res, i, i_rolcomment), conn);
-                       appendPQExpBuffer(buf, ";\n");
+                       appendPQExpBufferStr(buf, ";\n");
                }
 
                if (!no_security_labels && server_version >= 90200)
@@ -1068,9 +1068,9 @@ dumpTablespaces(PGconn *conn)
                appendPQExpBuffer(buf, "CREATE TABLESPACE %s", fspcname);
                appendPQExpBuffer(buf, " OWNER %s", fmtId(spcowner));
 
-               appendPQExpBuffer(buf, " LOCATION ");
+               appendPQExpBufferStr(buf, " LOCATION ");
                appendStringLiteralConn(buf, spclocation, conn);
-               appendPQExpBuffer(buf, ";\n");
+               appendPQExpBufferStr(buf, ";\n");
 
                if (spcoptions && spcoptions[0] != '\0')
                        appendPQExpBuffer(buf, "ALTER TABLESPACE %s SET (%s);\n",
@@ -1090,7 +1090,7 @@ dumpTablespaces(PGconn *conn)
                {
                        appendPQExpBuffer(buf, "COMMENT ON TABLESPACE %s IS ", fspcname);
                        appendStringLiteralConn(buf, spccomment, conn);
-                       appendPQExpBuffer(buf, ";\n");
+                       appendPQExpBufferStr(buf, ";\n");
                }
 
                if (!no_security_labels && server_version >= 90200)
@@ -1320,26 +1320,26 @@ dumpCreateDB(PGconn *conn)
                {
                        appendPQExpBuffer(buf, "CREATE DATABASE %s", fdbname);
 
-                       appendPQExpBuffer(buf, " WITH TEMPLATE = template0");
+                       appendPQExpBufferStr(buf, " WITH TEMPLATE = template0");
 
                        if (strlen(dbowner) != 0)
                                appendPQExpBuffer(buf, " OWNER = %s", fmtId(dbowner));
 
                        if (default_encoding && strcmp(dbencoding, default_encoding) != 0)
                        {
-                               appendPQExpBuffer(buf, " ENCODING = ");
+                               appendPQExpBufferStr(buf, " ENCODING = ");
                                appendStringLiteralConn(buf, dbencoding, conn);
                        }
 
                        if (default_collate && strcmp(dbcollate, default_collate) != 0)
                        {
-                               appendPQExpBuffer(buf, " LC_COLLATE = ");
+                               appendPQExpBufferStr(buf, " LC_COLLATE = ");
                                appendStringLiteralConn(buf, dbcollate, conn);
                        }
 
                        if (default_ctype && strcmp(dbctype, default_ctype) != 0)
                        {
-                               appendPQExpBuffer(buf, " LC_CTYPE = ");
+                               appendPQExpBufferStr(buf, " LC_CTYPE = ");
                                appendStringLiteralConn(buf, dbctype, conn);
                        }
 
@@ -1359,24 +1359,24 @@ dumpCreateDB(PGconn *conn)
                                appendPQExpBuffer(buf, " CONNECTION LIMIT = %s",
                                                                  dbconnlimit);
 
-                       appendPQExpBuffer(buf, ";\n");
+                       appendPQExpBufferStr(buf, ";\n");
 
                        if (strcmp(dbistemplate, "t") == 0)
                        {
-                               appendPQExpBuffer(buf, "UPDATE pg_catalog.pg_database SET datistemplate = 't' WHERE datname = ");
+                               appendPQExpBufferStr(buf, "UPDATE pg_catalog.pg_database SET datistemplate = 't' WHERE datname = ");
                                appendStringLiteralConn(buf, dbname, conn);
-                               appendPQExpBuffer(buf, ";\n");
+                               appendPQExpBufferStr(buf, ";\n");
                        }
 
                        if (binary_upgrade)
                        {
-                               appendPQExpBuffer(buf, "-- For binary upgrade, set datfrozenxid.\n");
+                               appendPQExpBufferStr(buf, "-- For binary upgrade, set datfrozenxid.\n");
                                appendPQExpBuffer(buf, "UPDATE pg_catalog.pg_database "
                                                                  "SET datfrozenxid = '%u' "
                                                                  "WHERE datname = ",
                                                                  dbfrozenxid);
                                appendStringLiteralConn(buf, dbname, conn);
-                               appendPQExpBuffer(buf, ";\n");
+                               appendPQExpBufferStr(buf, ";\n");
                        }
                }
 
@@ -1472,7 +1472,7 @@ dumpUserConfig(PGconn *conn, const char *username)
                        printfPQExpBuffer(buf, "SELECT useconfig[%d] FROM pg_shadow WHERE usename = ", count);
                appendStringLiteralConn(buf, username, conn);
                if (server_version >= 90000)
-                       appendPQExpBuffer(buf, ")");
+                       appendPQExpBufferChar(buf, ')');
 
                res = executeQuery(conn, buf->data);
                if (PQntuples(res) == 1 &&
@@ -1561,10 +1561,10 @@ makeAlterConfigCommand(PGconn *conn, const char *arrayitem,
         */
        if (pg_strcasecmp(mine, "DateStyle") == 0
                || pg_strcasecmp(mine, "search_path") == 0)
-               appendPQExpBuffer(buf, "%s", pos + 1);
+               appendPQExpBufferStr(buf, pos + 1);
        else
                appendStringLiteralConn(buf, pos + 1, conn);
-       appendPQExpBuffer(buf, ";\n");
+       appendPQExpBufferStr(buf, ";\n");
 
        fprintf(OPF, "%s", buf->data);
        destroyPQExpBuffer(buf);
@@ -1644,9 +1644,9 @@ runPgDump(const char *dbname)
         * format.
         */
        if (filename)
-               appendPQExpBuffer(cmd, " -Fa ");
+               appendPQExpBufferStr(cmd, " -Fa ");
        else
-               appendPQExpBuffer(cmd, " -Fp ");
+               appendPQExpBufferStr(cmd, " -Fp ");
 
        /*
         * Append the database name to the already-constructed stem of connection
@@ -1657,7 +1657,7 @@ runPgDump(const char *dbname)
 
        doShellQuoting(cmd, connstrbuf->data);
 
-       appendPQExpBuffer(cmd, "%s", SYSTEMQUOTE);
+       appendPQExpBufferStr(cmd, SYSTEMQUOTE);
 
        if (verbose)
                fprintf(stderr, _("%s: running \"%s\"\n"), progname, cmd->data);
@@ -2082,7 +2082,7 @@ doShellQuoting(PQExpBuffer buf, const char *str)
        for (p = str; *p; p++)
        {
                if (*p == '\'')
-                       appendPQExpBuffer(buf, "'\"'\"'");
+                       appendPQExpBufferStr(buf, "'\"'\"'");
                else
                        appendPQExpBufferChar(buf, *p);
        }
@@ -2093,7 +2093,7 @@ doShellQuoting(PQExpBuffer buf, const char *str)
        for (p = str; *p; p++)
        {
                if (*p == '"')
-                       appendPQExpBuffer(buf, "\\\"");
+                       appendPQExpBufferStr(buf, "\\\"");
                else
                        appendPQExpBufferChar(buf, *p);
        }
index d0e25a9e0a405cb585e3a753b7d715e7f255e803..638d8cb5c31977699c40a5c95b3f067cba8e1d5b 100644 (file)
@@ -2786,7 +2786,7 @@ lookup_function_oid(PGconn *conn, const char *desc, Oid *foid)
        PGresult   *res;
 
        query = createPQExpBuffer();
-       printfPQExpBuffer(query, "SELECT ");
+       appendPQExpBufferStr(query, "SELECT ");
        appendStringLiteralConn(query, desc, conn);
        appendPQExpBuffer(query, "::pg_catalog.%s::pg_catalog.oid",
                                          strchr(desc, '(') ? "regprocedure" : "regproc");
index a0c19a8de485fbae9ce9ba7034af1bd967bd516a..da0390172ae55d95d36e338bdd073abdacaa3373 100644 (file)
@@ -362,9 +362,9 @@ do_copy(const char *args)
        printfPQExpBuffer(&query, "COPY ");
        appendPQExpBufferStr(&query, options->before_tofrom);
        if (options->from)
-               appendPQExpBuffer(&query, " FROM STDIN ");
+               appendPQExpBufferStr(&query, " FROM STDIN ");
        else
-               appendPQExpBuffer(&query, " TO STDOUT ");
+               appendPQExpBufferStr(&query, " TO STDOUT ");
        if (options->after_tofrom)
                appendPQExpBufferStr(&query, options->after_tofrom);
 
index ceda13e921f4d185435282b7e37b8adaad90e6a1..96322ca85b8f058e40ad2646c7b99ea64c137da2 100644 (file)
@@ -105,14 +105,14 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem)
                                          gettext_noop("Description"));
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n"
+               appendPQExpBufferStr(&buf, "      AND n.nspname <> 'pg_catalog'\n"
                                                  "      AND n.nspname <> 'information_schema'\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, true, false,
                                                  "n.nspname", "p.proname", NULL,
                                                  "pg_catalog.pg_function_is_visible(p.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2, 4;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 4;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -167,7 +167,7 @@ describeTablespaces(const char *pattern, bool verbose)
 
        if (verbose)
        {
-               appendPQExpBuffer(&buf, ",\n  ");
+               appendPQExpBufferStr(&buf, ",\n  ");
                printACLColumn(&buf, "spcacl");
        }
 
@@ -176,14 +176,14 @@ describeTablespaces(const char *pattern, bool verbose)
                 ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
                                                  gettext_noop("Description"));
 
-       appendPQExpBuffer(&buf,
-                                         "\nFROM pg_catalog.pg_tablespace\n");
+       appendPQExpBufferStr(&buf,
+                                                "\nFROM pg_catalog.pg_tablespace\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, false, false,
                                                  NULL, "spcname", NULL,
                                                  NULL);
 
-       appendPQExpBuffer(&buf, "ORDER BY 1;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -359,12 +359,12 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
                                                  gettext_noop("Source code"),
                                                  gettext_noop("Description"));
 
-       appendPQExpBuffer(&buf,
-                                         "\nFROM pg_catalog.pg_proc p"
+       appendPQExpBufferStr(&buf,
+                                                "\nFROM pg_catalog.pg_proc p"
        "\n     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n");
 
        if (verbose)
-               appendPQExpBuffer(&buf,
+               appendPQExpBufferStr(&buf,
                   "     LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang\n");
 
        have_where = false;
@@ -377,65 +377,65 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
                if (!showAggregate)
                {
                        if (have_where)
-                               appendPQExpBuffer(&buf, "      AND ");
+                               appendPQExpBufferStr(&buf, "      AND ");
                        else
                        {
-                               appendPQExpBuffer(&buf, "WHERE ");
+                               appendPQExpBufferStr(&buf, "WHERE ");
                                have_where = true;
                        }
-                       appendPQExpBuffer(&buf, "NOT p.proisagg\n");
+                       appendPQExpBufferStr(&buf, "NOT p.proisagg\n");
                }
                if (!showTrigger)
                {
                        if (have_where)
-                               appendPQExpBuffer(&buf, "      AND ");
+                               appendPQExpBufferStr(&buf, "      AND ");
                        else
                        {
-                               appendPQExpBuffer(&buf, "WHERE ");
+                               appendPQExpBufferStr(&buf, "WHERE ");
                                have_where = true;
                        }
-                       appendPQExpBuffer(&buf, "p.prorettype <> 'pg_catalog.trigger'::pg_catalog.regtype\n");
+                       appendPQExpBufferStr(&buf, "p.prorettype <> 'pg_catalog.trigger'::pg_catalog.regtype\n");
                }
                if (!showWindow && pset.sversion >= 80400)
                {
                        if (have_where)
-                               appendPQExpBuffer(&buf, "      AND ");
+                               appendPQExpBufferStr(&buf, "      AND ");
                        else
                        {
-                               appendPQExpBuffer(&buf, "WHERE ");
+                               appendPQExpBufferStr(&buf, "WHERE ");
                                have_where = true;
                        }
-                       appendPQExpBuffer(&buf, "NOT p.proiswindow\n");
+                       appendPQExpBufferStr(&buf, "NOT p.proiswindow\n");
                }
        }
        else
        {
                bool            needs_or = false;
 
-               appendPQExpBuffer(&buf, "WHERE (\n       ");
+               appendPQExpBufferStr(&buf, "WHERE (\n       ");
                have_where = true;
                /* Note: at least one of these must be true ... */
                if (showAggregate)
                {
-                       appendPQExpBuffer(&buf, "p.proisagg\n");
+                       appendPQExpBufferStr(&buf, "p.proisagg\n");
                        needs_or = true;
                }
                if (showTrigger)
                {
                        if (needs_or)
-                               appendPQExpBuffer(&buf, "       OR ");
-                       appendPQExpBuffer(&buf,
+                               appendPQExpBufferStr(&buf, "       OR ");
+                       appendPQExpBufferStr(&buf,
                                "p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype\n");
                        needs_or = true;
                }
                if (showWindow)
                {
                        if (needs_or)
-                               appendPQExpBuffer(&buf, "       OR ");
-                       appendPQExpBuffer(&buf, "p.proiswindow\n");
+                               appendPQExpBufferStr(&buf, "       OR ");
+                       appendPQExpBufferStr(&buf, "p.proiswindow\n");
                        needs_or = true;
                }
-               appendPQExpBuffer(&buf, "      )\n");
+               appendPQExpBufferStr(&buf, "      )\n");
        }
 
        processSQLNamePattern(pset.db, &buf, pattern, have_where, false,
@@ -443,10 +443,10 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool
                                                  "pg_catalog.pg_function_is_visible(p.oid)");
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n"
+               appendPQExpBufferStr(&buf, "      AND n.nspname <> 'pg_catalog'\n"
                                                  "      AND n.nspname <> 'information_schema'\n");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2, 4;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 4;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -497,19 +497,19 @@ describeTypes(const char *pattern, bool verbose, bool showSystem)
                                                  gettext_noop("Size"));
        if (verbose && pset.sversion >= 80300)
        {
-               appendPQExpBuffer(&buf,
-                                                 "  pg_catalog.array_to_string(\n"
-                                                 "      ARRAY(\n"
-                                                 "                  SELECT e.enumlabel\n"
-                                                 "          FROM pg_catalog.pg_enum e\n"
-                                                 "          WHERE e.enumtypid = t.oid\n");
+               appendPQExpBufferStr(&buf,
+                                                        "  pg_catalog.array_to_string(\n"
+                                                        "      ARRAY(\n"
+                                                        "                   SELECT e.enumlabel\n"
+                                                        "          FROM pg_catalog.pg_enum e\n"
+                                                        "          WHERE e.enumtypid = t.oid\n");
 
                if (pset.sversion >= 90100)
-                       appendPQExpBuffer(&buf,
-                                                         "          ORDER BY e.enumsortorder\n");
+                       appendPQExpBufferStr(&buf,
+                                                                "          ORDER BY e.enumsortorder\n");
                else
-                       appendPQExpBuffer(&buf,
-                                                         "          ORDER BY e.oid\n");
+                       appendPQExpBufferStr(&buf,
+                                                                "          ORDER BY e.oid\n");
 
                appendPQExpBuffer(&buf,
                                                  "      ),\n"
@@ -520,22 +520,22 @@ describeTypes(const char *pattern, bool verbose, bool showSystem)
        if (verbose && pset.sversion >= 90200)
        {
                printACLColumn(&buf, "t.typacl");
-               appendPQExpBuffer(&buf, ",\n  ");
+               appendPQExpBufferStr(&buf, ",\n  ");
        }
 
        appendPQExpBuffer(&buf,
                                "  pg_catalog.obj_description(t.oid, 'pg_type') as \"%s\"\n",
                                          gettext_noop("Description"));
 
-       appendPQExpBuffer(&buf, "FROM pg_catalog.pg_type t\n"
+       appendPQExpBufferStr(&buf, "FROM pg_catalog.pg_type t\n"
         "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n");
 
        /*
         * do not include complex types (typrelid!=0) unless they are standalone
         * composite types
         */
-       appendPQExpBuffer(&buf, "WHERE (t.typrelid = 0 ");
-       appendPQExpBuffer(&buf, "OR (SELECT c.relkind = 'c' FROM pg_catalog.pg_class c "
+       appendPQExpBufferStr(&buf, "WHERE (t.typrelid = 0 ");
+       appendPQExpBufferStr(&buf, "OR (SELECT c.relkind = 'c' FROM pg_catalog.pg_class c "
                                          "WHERE c.oid = t.typrelid))\n");
 
        /*
@@ -543,13 +543,13 @@ describeTypes(const char *pattern, bool verbose, bool showSystem)
         * that their names start with underscore)
         */
        if (pset.sversion >= 80300)
-               appendPQExpBuffer(&buf, "  AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type el WHERE el.oid = t.typelem AND el.typarray = t.oid)\n");
+               appendPQExpBufferStr(&buf, "  AND NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type el WHERE el.oid = t.typelem AND el.typarray = t.oid)\n");
        else
-               appendPQExpBuffer(&buf, "  AND t.typname !~ '^_'\n");
+               appendPQExpBufferStr(&buf, "  AND t.typname !~ '^_'\n");
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n"
-                                                 "      AND n.nspname <> 'information_schema'\n");
+               appendPQExpBufferStr(&buf, "      AND n.nspname <> 'pg_catalog'\n"
+                                                                  "      AND n.nspname <> 'information_schema'\n");
 
        /* Match name pattern against either internal or external name */
        processSQLNamePattern(pset.db, &buf, pattern, true, false,
@@ -557,7 +557,7 @@ describeTypes(const char *pattern, bool verbose, bool showSystem)
                                                  "pg_catalog.format_type(t.oid, NULL)",
                                                  "pg_catalog.pg_type_is_visible(t.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -617,14 +617,14 @@ describeOperators(const char *pattern, bool showSystem)
                                          gettext_noop("Description"));
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n"
-                                                 "      AND n.nspname <> 'information_schema'\n");
+               appendPQExpBufferStr(&buf, "WHERE n.nspname <> 'pg_catalog'\n"
+                                                        "      AND n.nspname <> 'information_schema'\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, true,
                                                  "n.nspname", "o.oprname", NULL,
                                                  "pg_catalog.pg_operator_is_visible(o.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2, 3, 4;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 3, 4;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -669,7 +669,7 @@ listAllDbs(const char *pattern, bool verbose)
                                                  "       d.datctype as \"%s\",\n",
                                                  gettext_noop("Collate"),
                                                  gettext_noop("Ctype"));
-       appendPQExpBuffer(&buf, "       ");
+       appendPQExpBufferStr(&buf, "       ");
        printACLColumn(&buf, "d.datacl");
        if (verbose && pset.sversion >= 80200)
                appendPQExpBuffer(&buf,
@@ -686,17 +686,17 @@ listAllDbs(const char *pattern, bool verbose)
                appendPQExpBuffer(&buf,
                                                  ",\n       pg_catalog.shobj_description(d.oid, 'pg_database') as \"%s\"",
                                                  gettext_noop("Description"));
-       appendPQExpBuffer(&buf,
-                                         "\nFROM pg_catalog.pg_database d\n");
+       appendPQExpBufferStr(&buf,
+                                                "\nFROM pg_catalog.pg_database d\n");
        if (verbose && pset.sversion >= 80000)
-               appendPQExpBuffer(&buf,
+               appendPQExpBufferStr(&buf,
                   "  JOIN pg_catalog.pg_tablespace t on d.dattablespace = t.oid\n");
 
        if (pattern)
                processSQLNamePattern(pset.db, &buf, pattern, false, false,
                                                          NULL, "d.datname", NULL, NULL);
 
-       appendPQExpBuffer(&buf, "ORDER BY 1;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1;");
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
        if (!res)
@@ -761,7 +761,7 @@ permissionsList(const char *pattern)
                                                  "  ), E'\\n') AS \"%s\"",
                                                  gettext_noop("Column access privileges"));
 
-       appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_class c\n"
+       appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_class c\n"
           "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"
                                          "WHERE c.relkind IN ('r', 'v', 'm', 'S', 'f')\n");
 
@@ -775,7 +775,7 @@ permissionsList(const char *pattern)
                                                  "n.nspname", "c.relname", NULL,
                        "n.nspname !~ '^pg_' AND pg_catalog.pg_table_is_visible(c.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
 
        res = PSQLexec(buf.data, false);
        if (!res)
@@ -839,8 +839,8 @@ listDefaultACLs(const char *pattern)
 
        printACLColumn(&buf, "d.defaclacl");
 
-       appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_default_acl d\n"
-                                         "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = d.defaclnamespace\n");
+       appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_default_acl d\n"
+                                                "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = d.defaclnamespace\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, false, false,
                                                  NULL,
@@ -848,7 +848,7 @@ listDefaultACLs(const char *pattern)
                                                  "pg_catalog.pg_get_userbyid(d.defaclrole)",
                                                  NULL);
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2, 3;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 3;");
 
        res = PSQLexec(buf.data, false);
        if (!res)
@@ -914,8 +914,8 @@ objectDescription(const char *pattern, bool showSystem)
                                          gettext_noop("constraint"));
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n"
-                                                 "      AND n.nspname <> 'information_schema'\n");
+               appendPQExpBufferStr(&buf, "WHERE n.nspname <> 'pg_catalog'\n"
+                                                        "      AND n.nspname <> 'information_schema'\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern,
                                                  false, "n.nspname", "pgc.conname", NULL,
@@ -941,8 +941,8 @@ objectDescription(const char *pattern, bool showSystem)
                                                  gettext_noop("operator class"));
 
                if (!showSystem && !pattern)
-                       appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n"
-                                                       "      AND n.nspname <> 'information_schema'\n");
+                       appendPQExpBufferStr(&buf, "      AND n.nspname <> 'pg_catalog'\n"
+                                                                "      AND n.nspname <> 'information_schema'\n");
 
                processSQLNamePattern(pset.db, &buf, pattern, true, false,
                                                          "n.nspname", "o.opcname", NULL,
@@ -970,8 +970,8 @@ objectDescription(const char *pattern, bool showSystem)
                                                  gettext_noop("operator family"));
 
                if (!showSystem && !pattern)
-                       appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n"
-                                                       "      AND n.nspname <> 'information_schema'\n");
+                       appendPQExpBufferStr(&buf, "      AND n.nspname <> 'pg_catalog'\n"
+                                                                "      AND n.nspname <> 'information_schema'\n");
 
                processSQLNamePattern(pset.db, &buf, pattern, true, false,
                                                          "n.nspname", "opf.opfname", NULL,
@@ -992,8 +992,8 @@ objectDescription(const char *pattern, bool showSystem)
                                          gettext_noop("rule"));
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n"
-                                                 "      AND n.nspname <> 'information_schema'\n");
+               appendPQExpBufferStr(&buf, "      AND n.nspname <> 'pg_catalog'\n"
+                                                        "      AND n.nspname <> 'information_schema'\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, true, false,
                                                  "n.nspname", "r.rulename", NULL,
@@ -1012,18 +1012,18 @@ objectDescription(const char *pattern, bool showSystem)
                                          gettext_noop("trigger"));
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n"
-                                                 "      AND n.nspname <> 'information_schema'\n");
+               appendPQExpBufferStr(&buf, "WHERE n.nspname <> 'pg_catalog'\n"
+                                                        "      AND n.nspname <> 'information_schema'\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, false,
                                                  "n.nspname", "t.tgname", NULL,
                                                  "pg_catalog.pg_table_is_visible(c.oid)");
 
-       appendPQExpBuffer(&buf,
-                                         ") AS tt\n"
-                                         "  JOIN pg_catalog.pg_description d ON (tt.oid = d.objoid AND tt.tableoid = d.classoid AND d.objsubid = 0)\n");
+       appendPQExpBufferStr(&buf,
+                                                ") AS tt\n"
+                                                "  JOIN pg_catalog.pg_description d ON (tt.oid = d.objoid AND tt.tableoid = d.classoid AND d.objsubid = 0)\n");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2, 3;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2, 3;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -1067,14 +1067,14 @@ describeTableDetails(const char *pattern, bool verbose, bool showSystem)
         "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n");
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf, "WHERE n.nspname <> 'pg_catalog'\n"
-                                                 "      AND n.nspname <> 'information_schema'\n");
+               appendPQExpBufferStr(&buf, "WHERE n.nspname <> 'pg_catalog'\n"
+                                                        "      AND n.nspname <> 'information_schema'\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, false,
                                                  "n.nspname", "c.relname", NULL,
                                                  "pg_catalog.pg_table_is_visible(c.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 2, 3;");
+       appendPQExpBufferStr(&buf, "ORDER BY 2, 3;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -1330,30 +1330,30 @@ describeOneTableDetails(const char *schemaname,
         * you are adding column(s) preceding to verbose-only columns.
         */
        printfPQExpBuffer(&buf, "SELECT a.attname,");
-       appendPQExpBuffer(&buf, "\n  pg_catalog.format_type(a.atttypid, a.atttypmod),"
-                                         "\n  (SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128)"
-                                         "\n   FROM pg_catalog.pg_attrdef d"
-                                         "\n   WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef),"
-                                         "\n  a.attnotnull, a.attnum,");
+       appendPQExpBufferStr(&buf, "\n  pg_catalog.format_type(a.atttypid, a.atttypmod),"
+                                                "\n  (SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128)"
+                                                "\n   FROM pg_catalog.pg_attrdef d"
+                                                "\n   WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef),"
+                                                "\n  a.attnotnull, a.attnum,");
        if (pset.sversion >= 90100)
-               appendPQExpBuffer(&buf, "\n  (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
-                                                 "   WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
+               appendPQExpBufferStr(&buf, "\n  (SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t\n"
+                                                        "   WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation");
        else
-               appendPQExpBuffer(&buf, "\n  NULL AS attcollation");
+               appendPQExpBufferStr(&buf, "\n  NULL AS attcollation");
        if (tableinfo.relkind == 'i')
-               appendPQExpBuffer(&buf, ",\n  pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
+               appendPQExpBufferStr(&buf, ",\n  pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS indexdef");
        else
-               appendPQExpBuffer(&buf, ",\n  NULL AS indexdef");
+               appendPQExpBufferStr(&buf, ",\n  NULL AS indexdef");
        if (tableinfo.relkind == 'f' && pset.sversion >= 90200)
-               appendPQExpBuffer(&buf, ",\n  CASE WHEN attfdwoptions IS NULL THEN '' ELSE "
+               appendPQExpBufferStr(&buf, ",\n  CASE WHEN attfdwoptions IS NULL THEN '' ELSE "
                                                  "  '(' || array_to_string(ARRAY(SELECT quote_ident(option_name) ||  ' ' || quote_literal(option_value)  FROM "
                                                  "  pg_options_to_table(attfdwoptions)), ', ') || ')' END AS attfdwoptions");
        else
-               appendPQExpBuffer(&buf, ",\n  NULL AS attfdwoptions");
+               appendPQExpBufferStr(&buf, ",\n  NULL AS attfdwoptions");
        if (verbose)
        {
-               appendPQExpBuffer(&buf, ",\n  a.attstorage");
-               appendPQExpBuffer(&buf, ",\n  CASE WHEN a.attstattarget=-1 THEN NULL ELSE a.attstattarget END AS attstattarget");
+               appendPQExpBufferStr(&buf, ",\n  a.attstorage");
+               appendPQExpBufferStr(&buf, ",\n  CASE WHEN a.attstattarget=-1 THEN NULL ELSE a.attstattarget END AS attstattarget");
 
                /*
                 * In 9.0+, we have column comments for: relations, views, composite
@@ -1362,12 +1362,12 @@ describeOneTableDetails(const char *schemaname,
                if (tableinfo.relkind == 'r' || tableinfo.relkind == 'v' ||
                        tableinfo.relkind == 'm' ||
                        tableinfo.relkind == 'f' || tableinfo.relkind == 'c')
-                       appendPQExpBuffer(&buf, ", pg_catalog.col_description(a.attrelid, a.attnum)");
+                       appendPQExpBufferStr(&buf, ", pg_catalog.col_description(a.attrelid, a.attnum)");
        }
 
-       appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_attribute a");
+       appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_attribute a");
        appendPQExpBuffer(&buf, "\nWHERE a.attrelid = '%s' AND a.attnum > 0 AND NOT a.attisdropped", oid);
-       appendPQExpBuffer(&buf, "\nORDER BY a.attnum;");
+       appendPQExpBufferStr(&buf, "\nORDER BY a.attnum;");
 
        res = PSQLexec(buf.data, false);
        if (!res)
@@ -1589,25 +1589,25 @@ describeOneTableDetails(const char *schemaname,
                printfPQExpBuffer(&buf,
                                 "SELECT i.indisunique, i.indisprimary, i.indisclustered, ");
                if (pset.sversion >= 80200)
-                       appendPQExpBuffer(&buf, "i.indisvalid,\n");
+                       appendPQExpBufferStr(&buf, "i.indisvalid,\n");
                else
-                       appendPQExpBuffer(&buf, "true AS indisvalid,\n");
+                       appendPQExpBufferStr(&buf, "true AS indisvalid,\n");
                if (pset.sversion >= 90000)
-                       appendPQExpBuffer(&buf,
-                                                         "  (NOT i.indimmediate) AND "
-                                                       "EXISTS (SELECT 1 FROM pg_catalog.pg_constraint "
-                                                         "WHERE conrelid = i.indrelid AND "
-                                                         "conindid = i.indexrelid AND "
-                                                         "contype IN ('p','u','x') AND "
-                                                         "condeferrable) AS condeferrable,\n"
-                                                         "  (NOT i.indimmediate) AND "
-                                                       "EXISTS (SELECT 1 FROM pg_catalog.pg_constraint "
-                                                         "WHERE conrelid = i.indrelid AND "
-                                                         "conindid = i.indexrelid AND "
-                                                         "contype IN ('p','u','x') AND "
-                                                         "condeferred) AS condeferred,\n");
+                       appendPQExpBufferStr(&buf,
+                                                                "  (NOT i.indimmediate) AND "
+                                                               "EXISTS (SELECT 1 FROM pg_catalog.pg_constraint "
+                                                                "WHERE conrelid = i.indrelid AND "
+                                                                "conindid = i.indexrelid AND "
+                                                                "contype IN ('p','u','x') AND "
+                                                                "condeferrable) AS condeferrable,\n"
+                                                                "  (NOT i.indimmediate) AND "
+                                                               "EXISTS (SELECT 1 FROM pg_catalog.pg_constraint "
+                                                                "WHERE conrelid = i.indrelid AND "
+                                                                "conindid = i.indexrelid AND "
+                                                                "contype IN ('p','u','x') AND "
+                                                                "condeferred) AS condeferred,\n");
                else
-                       appendPQExpBuffer(&buf,
+                       appendPQExpBufferStr(&buf,
                                                "  false AS condeferrable, false AS condeferred,\n");
 
                if (pset.sversion >= 90400)
@@ -1659,16 +1659,16 @@ describeOneTableDetails(const char *schemaname,
                                appendPQExpBuffer(&tmpbuf, _(", predicate (%s)"), indpred);
 
                        if (strcmp(indisclustered, "t") == 0)
-                               appendPQExpBuffer(&tmpbuf, _(", clustered"));
+                               appendPQExpBufferStr(&tmpbuf, _(", clustered"));
 
                        if (strcmp(indisvalid, "t") != 0)
-                               appendPQExpBuffer(&tmpbuf, _(", invalid"));
+                               appendPQExpBufferStr(&tmpbuf, _(", invalid"));
 
                        if (strcmp(deferrable, "t") == 0)
-                               appendPQExpBuffer(&tmpbuf, _(", deferrable"));
+                               appendPQExpBufferStr(&tmpbuf, _(", deferrable"));
 
                        if (strcmp(deferred, "t") == 0)
-                               appendPQExpBuffer(&tmpbuf, _(", initially deferred"));
+                               appendPQExpBufferStr(&tmpbuf, _(", initially deferred"));
 
                        if (strcmp(indisreplident, "t") == 0)
                                appendPQExpBuffer(&tmpbuf, _(", replica identity"));
@@ -1731,29 +1731,29 @@ describeOneTableDetails(const char *schemaname,
                        printfPQExpBuffer(&buf,
                                                          "SELECT c2.relname, i.indisprimary, i.indisunique, i.indisclustered, ");
                        if (pset.sversion >= 80200)
-                               appendPQExpBuffer(&buf, "i.indisvalid, ");
+                               appendPQExpBufferStr(&buf, "i.indisvalid, ");
                        else
-                               appendPQExpBuffer(&buf, "true as indisvalid, ");
-                       appendPQExpBuffer(&buf, "pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n  ");
+                               appendPQExpBufferStr(&buf, "true as indisvalid, ");
+                       appendPQExpBufferStr(&buf, "pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n  ");
                        if (pset.sversion >= 90000)
-                               appendPQExpBuffer(&buf,
+                               appendPQExpBufferStr(&buf,
                                                   "pg_catalog.pg_get_constraintdef(con.oid, true), "
                                                                  "contype, condeferrable, condeferred");
                        else
-                               appendPQExpBuffer(&buf,
-                                                                 "null AS constraintdef, null AS contype, "
-                                                        "false AS condeferrable, false AS condeferred");
+                               appendPQExpBufferStr(&buf,
+                                                                        "null AS constraintdef, null AS contype, "
+                                                                        "false AS condeferrable, false AS condeferred");
                        if (pset.sversion >= 90400)
-                               appendPQExpBuffer(&buf, ", i.indisreplident");
+                               appendPQExpBufferStr(&buf, ", i.indisreplident");
                        else
-                               appendPQExpBuffer(&buf, ", false AS indisreplident");
+                               appendPQExpBufferStr(&buf, ", false AS indisreplident");
                        if (pset.sversion >= 80000)
-                               appendPQExpBuffer(&buf, ", c2.reltablespace");
-                       appendPQExpBuffer(&buf,
-                                                         "\nFROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i\n");
+                               appendPQExpBufferStr(&buf, ", c2.reltablespace");
+                       appendPQExpBufferStr(&buf,
+                                                                "\nFROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i\n");
                        if (pset.sversion >= 90000)
-                               appendPQExpBuffer(&buf,
-                                                                 "  LEFT JOIN pg_catalog.pg_constraint con ON (conrelid = i.indrelid AND conindid = i.indexrelid AND contype IN ('p','u','x'))\n");
+                               appendPQExpBufferStr(&buf,
+                                                                        "  LEFT JOIN pg_catalog.pg_constraint con ON (conrelid = i.indrelid AND conindid = i.indexrelid AND contype IN ('p','u','x'))\n");
                        appendPQExpBuffer(&buf,
                                                          "WHERE c.oid = '%s' AND c.oid = i.indrelid AND i.indexrelid = c2.oid\n"
                         "ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname;",
@@ -1786,13 +1786,13 @@ describeOneTableDetails(const char *schemaname,
 
                                                /* Label as primary key or unique (but not both) */
                                                if (strcmp(PQgetvalue(result, i, 1), "t") == 0)
-                                                       appendPQExpBuffer(&buf, " PRIMARY KEY,");
+                                                       appendPQExpBufferStr(&buf, " PRIMARY KEY,");
                                                else if (strcmp(PQgetvalue(result, i, 2), "t") == 0)
                                                {
                                                        if (strcmp(PQgetvalue(result, i, 7), "u") == 0)
-                                                               appendPQExpBuffer(&buf, " UNIQUE CONSTRAINT,");
+                                                               appendPQExpBufferStr(&buf, " UNIQUE CONSTRAINT,");
                                                        else
-                                                               appendPQExpBuffer(&buf, " UNIQUE,");
+                                                               appendPQExpBufferStr(&buf, " UNIQUE,");
                                                }
 
                                                /* Everything after "USING" is echoed verbatim */
@@ -1804,18 +1804,18 @@ describeOneTableDetails(const char *schemaname,
 
                                                /* Need these for deferrable PK/UNIQUE indexes */
                                                if (strcmp(PQgetvalue(result, i, 8), "t") == 0)
-                                                       appendPQExpBuffer(&buf, " DEFERRABLE");
+                                                       appendPQExpBufferStr(&buf, " DEFERRABLE");
 
                                                if (strcmp(PQgetvalue(result, i, 9), "t") == 0)
-                                                       appendPQExpBuffer(&buf, " INITIALLY DEFERRED");
+                                                       appendPQExpBufferStr(&buf, " INITIALLY DEFERRED");
                                        }
 
                                        /* Add these for all cases */
                                        if (strcmp(PQgetvalue(result, i, 3), "t") == 0)
-                                               appendPQExpBuffer(&buf, " CLUSTER");
+                                               appendPQExpBufferStr(&buf, " CLUSTER");
 
                                        if (strcmp(PQgetvalue(result, i, 4), "t") != 0)
-                                               appendPQExpBuffer(&buf, " INVALID");
+                                               appendPQExpBufferStr(&buf, " INVALID");
 
                                        if (strcmp(PQgetvalue(result, i, 10), "t") == 0)
                                                appendPQExpBuffer(&buf, " REPLICA IDENTITY");
@@ -2079,17 +2079,17 @@ describeOneTableDetails(const char *schemaname,
                                                  (pset.sversion >= 90000 ? ", true" : ""),
                                                  oid);
                if (pset.sversion >= 90000)
-                       appendPQExpBuffer(&buf, "NOT t.tgisinternal");
+                       appendPQExpBufferStr(&buf, "NOT t.tgisinternal");
                else if (pset.sversion >= 80300)
-                       appendPQExpBuffer(&buf, "t.tgconstraint = 0");
+                       appendPQExpBufferStr(&buf, "t.tgconstraint = 0");
                else
-                       appendPQExpBuffer(&buf,
-                                                         "(NOT tgisconstraint "
-                                                         " OR NOT EXISTS"
-                                                         "  (SELECT 1 FROM pg_catalog.pg_depend d "
-                                                         "   JOIN pg_catalog.pg_constraint c ON (d.refclassid = c.tableoid AND d.refobjid = c.oid) "
-                                                         "   WHERE d.classid = t.tableoid AND d.objid = t.oid AND d.deptype = 'i' AND c.contype = 'f'))");
-               appendPQExpBuffer(&buf, "\nORDER BY 1;");
+                       appendPQExpBufferStr(&buf,
+                                                                "(NOT tgisconstraint "
+                                                                " OR NOT EXISTS"
+                                                                "  (SELECT 1 FROM pg_catalog.pg_depend d "
+                                                                "   JOIN pg_catalog.pg_constraint c ON (d.refclassid = c.tableoid AND d.refobjid = c.oid) "
+                                                                "   WHERE d.classid = t.tableoid AND d.objid = t.oid AND d.deptype = 'i' AND c.contype = 'f'))");
+               appendPQExpBufferStr(&buf, "\nORDER BY 1;");
 
                result = PSQLexec(buf.data, false);
                if (!result)
@@ -2252,7 +2252,7 @@ describeOneTableDetails(const char *schemaname,
                                        printfPQExpBuffer(&buf, "%*s  %s",
                                                                          sw, "", PQgetvalue(result, i, 0));
                                if (i < tuples - 1)
-                                       appendPQExpBuffer(&buf, ",");
+                                       appendPQExpBufferStr(&buf, ",");
 
                                printTableAddFooter(&cont, buf.data);
                        }
@@ -2296,7 +2296,7 @@ describeOneTableDetails(const char *schemaname,
                                        printfPQExpBuffer(&buf, "%*s  %s",
                                                                          ctw, "", PQgetvalue(result, i, 0));
                                if (i < tuples - 1)
-                                       appendPQExpBuffer(&buf, ",");
+                                       appendPQExpBufferChar(&buf, ',');
 
                                printTableAddFooter(&cont, buf.data);
                        }
@@ -2506,7 +2506,7 @@ describeRoles(const char *pattern, bool verbose)
                                                          NULL, "u.usename", NULL, NULL);
        }
 
-       appendPQExpBuffer(&buf, "ORDER BY 1;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1;");
 
        res = PSQLexec(buf.data, false);
        if (!res)
@@ -2552,10 +2552,10 @@ describeRoles(const char *pattern, bool verbose)
                if (conns >= 0)
                {
                        if (buf.len > 0)
-                               appendPQExpBufferStr(&buf, "\n");
+                               appendPQExpBufferChar(&buf, '\n');
 
                        if (conns == 0)
-                               appendPQExpBuffer(&buf, _("No connections"));
+                               appendPQExpBufferStr(&buf, _("No connections"));
                        else
                                appendPQExpBuffer(&buf, ngettext("%d connection",
                                                                                                 "%d connections",
@@ -2754,37 +2754,37 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys
                                                  gettext_noop("Description"));
        }
 
-       appendPQExpBuffer(&buf,
-                                         "\nFROM pg_catalog.pg_class c"
+       appendPQExpBufferStr(&buf,
+                                                "\nFROM pg_catalog.pg_class c"
         "\n     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace");
        if (showIndexes)
-               appendPQExpBuffer(&buf,
+               appendPQExpBufferStr(&buf,
                         "\n     LEFT JOIN pg_catalog.pg_index i ON i.indexrelid = c.oid"
                   "\n     LEFT JOIN pg_catalog.pg_class c2 ON i.indrelid = c2.oid");
 
-       appendPQExpBuffer(&buf, "\nWHERE c.relkind IN (");
+       appendPQExpBufferStr(&buf, "\nWHERE c.relkind IN (");
        if (showTables)
-               appendPQExpBuffer(&buf, "'r',");
+               appendPQExpBufferStr(&buf, "'r',");
        if (showViews)
-               appendPQExpBuffer(&buf, "'v',");
+               appendPQExpBufferStr(&buf, "'v',");
        if (showMatViews)
-               appendPQExpBuffer(&buf, "'m',");
+               appendPQExpBufferStr(&buf, "'m',");
        if (showIndexes)
-               appendPQExpBuffer(&buf, "'i',");
+               appendPQExpBufferStr(&buf, "'i',");
        if (showSeq)
-               appendPQExpBuffer(&buf, "'S',");
+               appendPQExpBufferStr(&buf, "'S',");
        if (showSystem || pattern)
-               appendPQExpBuffer(&buf, "'s',");                /* was RELKIND_SPECIAL in <=
+               appendPQExpBufferStr(&buf, "'s',");             /* was RELKIND_SPECIAL in <=
                                                                                                 * 8.1 */
        if (showForeign)
-               appendPQExpBuffer(&buf, "'f',");
+               appendPQExpBufferStr(&buf, "'f',");
 
-       appendPQExpBuffer(&buf, "''");          /* dummy */
-       appendPQExpBuffer(&buf, ")\n");
+       appendPQExpBufferStr(&buf, "''");               /* dummy */
+       appendPQExpBufferStr(&buf, ")\n");
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n"
-                                                 "      AND n.nspname <> 'information_schema'\n");
+               appendPQExpBufferStr(&buf, "      AND n.nspname <> 'pg_catalog'\n"
+                                                        "      AND n.nspname <> 'information_schema'\n");
 
        /*
         * TOAST objects are suppressed unconditionally.  Since we don't provide
@@ -2792,13 +2792,13 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys
         * in any case; it seems a bit confusing to allow their indexes to be
         * shown. Use plain \d if you really need to look at a TOAST table/index.
         */
-       appendPQExpBuffer(&buf, "      AND n.nspname !~ '^pg_toast'\n");
+       appendPQExpBufferStr(&buf, "      AND n.nspname !~ '^pg_toast'\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, true, false,
                                                  "n.nspname", "c.relname", NULL,
                                                  "pg_catalog.pg_table_is_visible(c.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1,2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1,2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -2881,10 +2881,10 @@ listLanguages(const char *pattern, bool verbose, bool showSystem)
                                                          NULL, "l.lanname", NULL, NULL);
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf, "WHERE l.lanplcallfoid != 0\n");
+               appendPQExpBufferStr(&buf, "WHERE l.lanplcallfoid != 0\n");
 
 
-       appendPQExpBuffer(&buf, "ORDER BY 1;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -2926,9 +2926,9 @@ listDomains(const char *pattern, bool verbose, bool showSystem)
                                          gettext_noop("Type"));
 
        if (pset.sversion >= 90100)
-               appendPQExpBuffer(&buf,
-                                                 "            COALESCE((SELECT ' collate ' || c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type bt\n"
-                                                 "                      WHERE c.oid = t.typcollation AND bt.oid = t.typbasetype AND t.typcollation <> bt.typcollation), '') ||\n");
+               appendPQExpBufferStr(&buf,
+                                                        "            COALESCE((SELECT ' collate ' || c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type bt\n"
+                                                        "                      WHERE c.oid = t.typcollation AND bt.oid = t.typbasetype AND t.typcollation <> bt.typcollation), '') ||\n");
        appendPQExpBuffer(&buf,
           "            CASE WHEN t.typnotnull THEN ' not null' ELSE '' END ||\n"
                                          "            CASE WHEN t.typdefault IS NOT NULL THEN ' default ' || t.typdefault ELSE '' END\n"
@@ -2943,7 +2943,7 @@ listDomains(const char *pattern, bool verbose, bool showSystem)
        {
                if (pset.sversion >= 90200)
                {
-                       appendPQExpBuffer(&buf, ",\n  ");
+                       appendPQExpBufferStr(&buf, ",\n  ");
                        printACLColumn(&buf, "t.typacl");
                }
                appendPQExpBuffer(&buf,
@@ -2951,27 +2951,27 @@ listDomains(const char *pattern, bool verbose, bool showSystem)
                                                  gettext_noop("Description"));
        }
 
-       appendPQExpBuffer(&buf,
-                                         "\nFROM pg_catalog.pg_type t\n"
+       appendPQExpBufferStr(&buf,
+                                                "\nFROM pg_catalog.pg_type t\n"
         "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n");
 
        if (verbose)
-               appendPQExpBuffer(&buf,
-                                                 "     LEFT JOIN pg_catalog.pg_description d "
-                                                 "ON d.classoid = t.tableoid AND d.objoid = t.oid "
-                                                 "AND d.objsubid = 0\n");
+               appendPQExpBufferStr(&buf,
+                                                        "     LEFT JOIN pg_catalog.pg_description d "
+                                                        "ON d.classoid = t.tableoid AND d.objoid = t.oid "
+                                                        "AND d.objsubid = 0\n");
 
-       appendPQExpBuffer(&buf, "WHERE t.typtype = 'd'\n");
+       appendPQExpBufferStr(&buf, "WHERE t.typtype = 'd'\n");
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n"
-                                                 "      AND n.nspname <> 'information_schema'\n");
+               appendPQExpBufferStr(&buf, "      AND n.nspname <> 'pg_catalog'\n"
+                                                        "      AND n.nspname <> 'information_schema'\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, true, false,
                                                  "n.nspname", "t.typname", NULL,
                                                  "pg_catalog.pg_type_is_visible(t.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -3022,29 +3022,29 @@ listConversions(const char *pattern, bool verbose, bool showSystem)
                                                  ",\n       d.description AS \"%s\"",
                                                  gettext_noop("Description"));
 
-       appendPQExpBuffer(&buf,
-                                         "\nFROM pg_catalog.pg_conversion c\n"
-                                         "     JOIN pg_catalog.pg_namespace n "
-                                         "ON n.oid = c.connamespace\n");
+       appendPQExpBufferStr(&buf,
+                                                "\nFROM pg_catalog.pg_conversion c\n"
+                                                "     JOIN pg_catalog.pg_namespace n "
+                                                "ON n.oid = c.connamespace\n");
 
        if (verbose)
-               appendPQExpBuffer(&buf,
-                                                 "LEFT JOIN pg_catalog.pg_description d "
-                                                 "ON d.classoid = c.tableoid\n"
-                                                 "          AND d.objoid = c.oid "
-                                                 "AND d.objsubid = 0\n");
+               appendPQExpBufferStr(&buf,
+                                                        "LEFT JOIN pg_catalog.pg_description d "
+                                                        "ON d.classoid = c.tableoid\n"
+                                                        "          AND d.objoid = c.oid "
+                                                        "AND d.objsubid = 0\n");
 
-       appendPQExpBuffer(&buf, "WHERE true\n");
+       appendPQExpBufferStr(&buf, "WHERE true\n");
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf, "  AND n.nspname <> 'pg_catalog'\n"
+               appendPQExpBufferStr(&buf, "  AND n.nspname <> 'pg_catalog'\n"
                                                  "  AND n.nspname <> 'information_schema'\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, true, false,
                                                  "n.nspname", "c.conname", NULL,
                                                  "pg_catalog.pg_conversion_is_visible(c.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -3099,13 +3099,13 @@ listEventTriggers(const char *pattern, bool verbose)
                appendPQExpBuffer(&buf,
                ",\npg_catalog.obj_description(e.oid, 'pg_event_trigger') as \"%s\"",
                                                  gettext_noop("Description"));
-       appendPQExpBuffer(&buf,
-                                         "\nFROM pg_event_trigger e ");
+       appendPQExpBufferStr(&buf,
+                                                "\nFROM pg_event_trigger e ");
 
        processSQLNamePattern(pset.db, &buf, pattern, false, false,
                                                  NULL, "evtname", NULL, NULL);
 
-       appendPQExpBuffer(&buf, "ORDER BY 1");
+       appendPQExpBufferStr(&buf, "ORDER BY 1");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -3167,25 +3167,25 @@ listCasts(const char *pattern, bool verbose)
                                                  ",\n       d.description AS \"%s\"\n",
                                                  gettext_noop("Description"));
 
-       appendPQExpBuffer(&buf,
+       appendPQExpBufferStr(&buf,
                                 "FROM pg_catalog.pg_cast c LEFT JOIN pg_catalog.pg_proc p\n"
-                                         "     ON c.castfunc = p.oid\n"
-                                         "     LEFT JOIN pg_catalog.pg_type ts\n"
-                                         "     ON c.castsource = ts.oid\n"
-                                         "     LEFT JOIN pg_catalog.pg_namespace ns\n"
-                                         "     ON ns.oid = ts.typnamespace\n"
-                                         "     LEFT JOIN pg_catalog.pg_type tt\n"
-                                         "     ON c.casttarget = tt.oid\n"
-                                         "     LEFT JOIN pg_catalog.pg_namespace nt\n"
-                                         "     ON nt.oid = tt.typnamespace\n");
+                                                "     ON c.castfunc = p.oid\n"
+                                                "     LEFT JOIN pg_catalog.pg_type ts\n"
+                                                "     ON c.castsource = ts.oid\n"
+                                                "     LEFT JOIN pg_catalog.pg_namespace ns\n"
+                                                "     ON ns.oid = ts.typnamespace\n"
+                                                "     LEFT JOIN pg_catalog.pg_type tt\n"
+                                                "     ON c.casttarget = tt.oid\n"
+                                                "     LEFT JOIN pg_catalog.pg_namespace nt\n"
+                                                "     ON nt.oid = tt.typnamespace\n");
 
        if (verbose)
-               appendPQExpBuffer(&buf,
-                                                 "     LEFT JOIN pg_catalog.pg_description d\n"
-                                                 "     ON d.classoid = c.tableoid AND d.objoid = "
-                                                 "c.oid AND d.objsubid = 0\n");
+               appendPQExpBufferStr(&buf,
+                                                        "     LEFT JOIN pg_catalog.pg_description d\n"
+                                                        "     ON d.classoid = c.tableoid AND d.objoid = "
+                                                        "c.oid AND d.objsubid = 0\n");
 
-       appendPQExpBuffer(&buf, "WHERE ( (true");
+       appendPQExpBufferStr(&buf, "WHERE ( (true");
 
        /*
         * Match name pattern against either internal or external name of either
@@ -3196,14 +3196,14 @@ listCasts(const char *pattern, bool verbose)
                                                  "pg_catalog.format_type(ts.oid, NULL)",
                                                  "pg_catalog.pg_type_is_visible(ts.oid)");
 
-       appendPQExpBuffer(&buf, ") OR (true");
+       appendPQExpBufferStr(&buf, ") OR (true");
 
        processSQLNamePattern(pset.db, &buf, pattern, true, false,
                                                  "nt.nspname", "tt.typname",
                                                  "pg_catalog.format_type(tt.oid, NULL)",
                                                  "pg_catalog.pg_type_is_visible(tt.oid)");
 
-       appendPQExpBuffer(&buf, ") )\nORDER BY 1, 2;");
+       appendPQExpBufferStr(&buf, ") )\nORDER BY 1, 2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -3258,12 +3258,12 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
                                                  ",\n       pg_catalog.obj_description(c.oid, 'pg_collation') AS \"%s\"",
                                                  gettext_noop("Description"));
 
-       appendPQExpBuffer(&buf,
+       appendPQExpBufferStr(&buf,
                          "\nFROM pg_catalog.pg_collation c, pg_catalog.pg_namespace n\n"
                                          "WHERE n.oid = c.collnamespace\n");
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf, "      AND n.nspname <> 'pg_catalog'\n"
+               appendPQExpBufferStr(&buf, "      AND n.nspname <> 'pg_catalog'\n"
                                                  "      AND n.nspname <> 'information_schema'\n");
 
        /*
@@ -3272,13 +3272,13 @@ listCollations(const char *pattern, bool verbose, bool showSystem)
         * unusable collations, so you will need to hack name pattern processing
         * somehow to avoid inconsistent behavior.
         */
-       appendPQExpBuffer(&buf, "      AND c.collencoding IN (-1, pg_catalog.pg_char_to_encoding(pg_catalog.getdatabaseencoding()))\n");
+       appendPQExpBufferStr(&buf, "      AND c.collencoding IN (-1, pg_catalog.pg_char_to_encoding(pg_catalog.getdatabaseencoding()))\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, true, false,
                                                  "n.nspname", "c.collname", NULL,
                                                  "pg_catalog.pg_collation_is_visible(c.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -3317,7 +3317,7 @@ listSchemas(const char *pattern, bool verbose, bool showSystem)
 
        if (verbose)
        {
-               appendPQExpBuffer(&buf, ",\n  ");
+               appendPQExpBufferStr(&buf, ",\n  ");
                printACLColumn(&buf, "n.nspacl");
                appendPQExpBuffer(&buf,
                  ",\n  pg_catalog.obj_description(n.oid, 'pg_namespace') AS \"%s\"",
@@ -3328,7 +3328,7 @@ listSchemas(const char *pattern, bool verbose, bool showSystem)
                                          "\nFROM pg_catalog.pg_namespace n\n");
 
        if (!showSystem && !pattern)
-               appendPQExpBuffer(&buf,
+               appendPQExpBufferStr(&buf,
                "WHERE n.nspname !~ '^pg_' AND n.nspname <> 'information_schema'\n");
 
        processSQLNamePattern(pset.db, &buf, pattern,
@@ -3336,7 +3336,7 @@ listSchemas(const char *pattern, bool verbose, bool showSystem)
                                                  NULL, "n.nspname", NULL,
                                                  NULL);
 
-       appendPQExpBuffer(&buf, "ORDER BY 1;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -3393,7 +3393,7 @@ listTSParsers(const char *pattern, bool verbose)
                                                  "n.nspname", "p.prsname", NULL,
                                                  "pg_catalog.pg_ts_parser_is_visible(p.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -3434,7 +3434,7 @@ listTSParsersVerbose(const char *pattern)
                                                  "n.nspname", "p.prsname", NULL,
                                                  "pg_catalog.pg_ts_parser_is_visible(p.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -3630,14 +3630,14 @@ listTSDictionaries(const char *pattern, bool verbose)
                         "  pg_catalog.obj_description(d.oid, 'pg_ts_dict') as \"%s\"\n",
                                          gettext_noop("Description"));
 
-       appendPQExpBuffer(&buf, "FROM pg_catalog.pg_ts_dict d\n"
+       appendPQExpBufferStr(&buf, "FROM pg_catalog.pg_ts_dict d\n"
                 "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = d.dictnamespace\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, false, false,
                                                  "n.nspname", "d.dictname", NULL,
                                                  "pg_catalog.pg_ts_dict_is_visible(d.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -3698,14 +3698,14 @@ listTSTemplates(const char *pattern, bool verbose)
                                                  gettext_noop("Name"),
                                                  gettext_noop("Description"));
 
-       appendPQExpBuffer(&buf, "FROM pg_catalog.pg_ts_template t\n"
+       appendPQExpBufferStr(&buf, "FROM pg_catalog.pg_ts_template t\n"
                 "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.tmplnamespace\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, false, false,
                                                  "n.nspname", "t.tmplname", NULL,
                                                  "pg_catalog.pg_ts_template_is_visible(t.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -3762,7 +3762,7 @@ listTSConfigs(const char *pattern, bool verbose)
                                                  "n.nspname", "c.cfgname", NULL,
                                                  "pg_catalog.pg_ts_config_is_visible(c.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -3804,7 +3804,7 @@ listTSConfigsVerbose(const char *pattern)
                                                  "n.nspname", "c.cfgname", NULL,
                                                  "pg_catalog.pg_ts_config_is_visible(c.oid)");
 
-       appendPQExpBuffer(&buf, "ORDER BY 3, 2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 3, 2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -3955,7 +3955,7 @@ listForeignDataWrappers(const char *pattern, bool verbose)
 
        if (verbose)
        {
-               appendPQExpBuffer(&buf, ",\n  ");
+               appendPQExpBufferStr(&buf, ",\n  ");
                printACLColumn(&buf, "fdwacl");
                appendPQExpBuffer(&buf,
                                                  ",\n CASE WHEN fdwoptions IS NULL THEN '' ELSE "
@@ -3972,18 +3972,18 @@ listForeignDataWrappers(const char *pattern, bool verbose)
                                                          gettext_noop("Description"));
        }
 
-       appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_foreign_data_wrapper fdw\n");
+       appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_foreign_data_wrapper fdw\n");
 
        if (verbose && pset.sversion >= 90100)
-               appendPQExpBuffer(&buf,
-                                                 "LEFT JOIN pg_catalog.pg_description d\n"
-                                                 "       ON d.classoid = fdw.tableoid "
-                                                 "AND d.objoid = fdw.oid AND d.objsubid = 0\n");
+               appendPQExpBufferStr(&buf,
+                                                        "LEFT JOIN pg_catalog.pg_description d\n"
+                                                        "       ON d.classoid = fdw.tableoid "
+                                                        "AND d.objoid = fdw.oid AND d.objsubid = 0\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, false, false,
                                                  NULL, "fdwname", NULL, NULL);
 
-       appendPQExpBuffer(&buf, "ORDER BY 1;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -4030,7 +4030,7 @@ listForeignServers(const char *pattern, bool verbose)
 
        if (verbose)
        {
-               appendPQExpBuffer(&buf, ",\n  ");
+               appendPQExpBufferStr(&buf, ",\n  ");
                printACLColumn(&buf, "s.srvacl");
                appendPQExpBuffer(&buf,
                                                  ",\n"
@@ -4049,20 +4049,20 @@ listForeignServers(const char *pattern, bool verbose)
                                                  gettext_noop("Description"));
        }
 
-       appendPQExpBuffer(&buf,
-                                         "\nFROM pg_catalog.pg_foreign_server s\n"
+       appendPQExpBufferStr(&buf,
+                                                "\nFROM pg_catalog.pg_foreign_server s\n"
           "     JOIN pg_catalog.pg_foreign_data_wrapper f ON f.oid=s.srvfdw\n");
 
        if (verbose)
-               appendPQExpBuffer(&buf,
-                                                 "LEFT JOIN pg_description d\n       "
-                                                 "ON d.classoid = s.tableoid AND d.objoid = s.oid "
-                                                 "AND d.objsubid = 0\n");
+               appendPQExpBufferStr(&buf,
+                                                        "LEFT JOIN pg_description d\n       "
+                                                        "ON d.classoid = s.tableoid AND d.objoid = s.oid "
+                                                        "AND d.objsubid = 0\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, false, false,
                                                  NULL, "s.srvname", NULL, NULL);
 
-       appendPQExpBuffer(&buf, "ORDER BY 1;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -4115,12 +4115,12 @@ listUserMappings(const char *pattern, bool verbose)
                                                  "  END AS \"%s\"",
                                                  gettext_noop("FDW Options"));
 
-       appendPQExpBuffer(&buf, "\nFROM pg_catalog.pg_user_mappings um\n");
+       appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_user_mappings um\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, false, false,
                                                  NULL, "um.srvname", "um.usename", NULL);
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -4177,24 +4177,24 @@ listForeignTables(const char *pattern, bool verbose)
                                                  gettext_noop("FDW Options"),
                                                  gettext_noop("Description"));
 
-       appendPQExpBuffer(&buf,
-                                         "\nFROM pg_catalog.pg_foreign_table ft\n"
-                                         "  INNER JOIN pg_catalog.pg_class c"
-                                         " ON c.oid = ft.ftrelid\n"
-                                         "  INNER JOIN pg_catalog.pg_namespace n"
-                                         " ON n.oid = c.relnamespace\n"
-                                         "  INNER JOIN pg_catalog.pg_foreign_server s"
-                                         " ON s.oid = ft.ftserver\n");
+       appendPQExpBufferStr(&buf,
+                                                "\nFROM pg_catalog.pg_foreign_table ft\n"
+                                                "  INNER JOIN pg_catalog.pg_class c"
+                                                " ON c.oid = ft.ftrelid\n"
+                                                "  INNER JOIN pg_catalog.pg_namespace n"
+                                                " ON n.oid = c.relnamespace\n"
+                                                "  INNER JOIN pg_catalog.pg_foreign_server s"
+                                                " ON s.oid = ft.ftserver\n");
        if (verbose)
-               appendPQExpBuffer(&buf,
-                                                 "   LEFT JOIN pg_catalog.pg_description d\n"
-                                                 "          ON d.classoid = c.tableoid AND "
-                                                 "d.objoid = c.oid AND d.objsubid = 0\n");
+               appendPQExpBufferStr(&buf,
+                                                        "   LEFT JOIN pg_catalog.pg_description d\n"
+                                                        "          ON d.classoid = c.tableoid AND "
+                                                        "d.objoid = c.oid AND d.objsubid = 0\n");
 
        processSQLNamePattern(pset.db, &buf, pattern, false, false,
                                                  NULL, "n.nspname", "c.relname", NULL);
 
-       appendPQExpBuffer(&buf, "ORDER BY 1, 2;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -4248,7 +4248,7 @@ listExtensions(const char *pattern)
                                                  NULL, "e.extname", NULL,
                                                  NULL);
 
-       appendPQExpBuffer(&buf, "ORDER BY 1;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
@@ -4294,7 +4294,7 @@ listExtensionContents(const char *pattern)
                                                  NULL, "e.extname", NULL,
                                                  NULL);
 
-       appendPQExpBuffer(&buf, "ORDER BY 1;");
+       appendPQExpBufferStr(&buf, "ORDER BY 1;");
 
        res = PSQLexec(buf.data, false);
        termPQExpBuffer(&buf);
index f6c1aaf453272c2bff7344bd583deffb626af231..72f4652ac257f4578c730125cd28ed198ef746f9 100644 (file)
@@ -3613,8 +3613,8 @@ _complete_from_query(int is_schema_query, const char *text, int state)
                                           "pg_catalog.pg_class c") == 0 &&
                                strncmp(text, "pg_", 3) !=0)
                        {
-                               appendPQExpBuffer(&query_buffer,
-                                                                 " AND c.relnamespace <> (SELECT oid FROM"
+                               appendPQExpBufferStr(&query_buffer,
+                                                                        " AND c.relnamespace <> (SELECT oid FROM"
                                   " pg_catalog.pg_namespace WHERE nspname = 'pg_catalog')");
                        }
 
index 0ac213d3c3137b8fda88878c8fa83f97c09a87a8..cd54e8f47f77868b0756d78f1843278d3cc53d73 100644 (file)
@@ -196,12 +196,12 @@ cluster_one_database(const char *dbname, bool verbose, const char *table,
 
        initPQExpBuffer(&sql);
 
-       appendPQExpBuffer(&sql, "CLUSTER");
+       appendPQExpBufferStr(&sql, "CLUSTER");
        if (verbose)
-               appendPQExpBuffer(&sql, " VERBOSE");
+               appendPQExpBufferStr(&sql, " VERBOSE");
        if (table)
                appendPQExpBuffer(&sql, " %s", table);
-       appendPQExpBuffer(&sql, ";\n");
+       appendPQExpBufferStr(&sql, ";\n");
 
        conn = connectDatabase(dbname, host, port, username, prompt_password,
                                                   progname, false);
index 5b28f18a81a5acd67840a99596118d73e1fdcce6..14cd128490652f48977344f3a203e36a80dc8a5d 100644 (file)
@@ -195,7 +195,7 @@ main(int argc, char *argv[])
        if (lc_ctype)
                appendPQExpBuffer(&sql, " LC_CTYPE '%s'", lc_ctype);
 
-       appendPQExpBuffer(&sql, ";\n");
+       appendPQExpBufferStr(&sql, ";\n");
 
        /* No point in trying to use postgres db when creating postgres db. */
        if (maintenance_db == NULL && strcmp(dbname, "postgres") == 0)
@@ -222,7 +222,7 @@ main(int argc, char *argv[])
        {
                printfPQExpBuffer(&sql, "COMMENT ON DATABASE %s IS ", fmtId(dbname));
                appendStringLiteralConn(&sql, comment, conn);
-               appendPQExpBuffer(&sql, ";\n");
+               appendPQExpBufferStr(&sql, ";\n");
 
                if (echo)
                        printf("%s", sql.data);
index d1542d945ac0c84f4feb78e6d0e7e90788e3f556..83623ea87920f67a7c8d960cbe250abbe9d02ad9 100644 (file)
@@ -254,10 +254,10 @@ main(int argc, char *argv[])
        if (newpassword)
        {
                if (encrypted == TRI_YES)
-                       appendPQExpBuffer(&sql, " ENCRYPTED");
+                       appendPQExpBufferStr(&sql, " ENCRYPTED");
                if (encrypted == TRI_NO)
-                       appendPQExpBuffer(&sql, " UNENCRYPTED");
-               appendPQExpBuffer(&sql, " PASSWORD ");
+                       appendPQExpBufferStr(&sql, " UNENCRYPTED");
+               appendPQExpBufferStr(&sql, " PASSWORD ");
 
                if (encrypted != TRI_NO)
                {
@@ -277,32 +277,32 @@ main(int argc, char *argv[])
                        appendStringLiteralConn(&sql, newpassword, conn);
        }
        if (superuser == TRI_YES)
-               appendPQExpBuffer(&sql, " SUPERUSER");
+               appendPQExpBufferStr(&sql, " SUPERUSER");
        if (superuser == TRI_NO)
-               appendPQExpBuffer(&sql, " NOSUPERUSER");
+               appendPQExpBufferStr(&sql, " NOSUPERUSER");
        if (createdb == TRI_YES)
-               appendPQExpBuffer(&sql, " CREATEDB");
+               appendPQExpBufferStr(&sql, " CREATEDB");
        if (createdb == TRI_NO)
-               appendPQExpBuffer(&sql, " NOCREATEDB");
+               appendPQExpBufferStr(&sql, " NOCREATEDB");
        if (createrole == TRI_YES)
-               appendPQExpBuffer(&sql, " CREATEROLE");
+               appendPQExpBufferStr(&sql, " CREATEROLE");
        if (createrole == TRI_NO)
-               appendPQExpBuffer(&sql, " NOCREATEROLE");
+               appendPQExpBufferStr(&sql, " NOCREATEROLE");
        if (inherit == TRI_YES)
-               appendPQExpBuffer(&sql, " INHERIT");
+               appendPQExpBufferStr(&sql, " INHERIT");
        if (inherit == TRI_NO)
-               appendPQExpBuffer(&sql, " NOINHERIT");
+               appendPQExpBufferStr(&sql, " NOINHERIT");
        if (login == TRI_YES)
-               appendPQExpBuffer(&sql, " LOGIN");
+               appendPQExpBufferStr(&sql, " LOGIN");
        if (login == TRI_NO)
-               appendPQExpBuffer(&sql, " NOLOGIN");
+               appendPQExpBufferStr(&sql, " NOLOGIN");
        if (replication == TRI_YES)
-               appendPQExpBuffer(&sql, " REPLICATION");
+               appendPQExpBufferStr(&sql, " REPLICATION");
        if (replication == TRI_NO)
-               appendPQExpBuffer(&sql, " NOREPLICATION");
+               appendPQExpBufferStr(&sql, " NOREPLICATION");
        if (conn_limit != NULL)
                appendPQExpBuffer(&sql, " CONNECTION LIMIT %s", conn_limit);
-       appendPQExpBuffer(&sql, ";\n");
+       appendPQExpBufferStr(&sql, ";\n");
 
        if (echo)
                printf("%s", sql.data);
index 342e4c94d1a1cb8032062b0794805522f3bcbc0e..f7c09bebf8a4789b86dc8dbc891a0b3ae2c6e6e7 100644 (file)
@@ -246,14 +246,14 @@ reindex_one_database(const char *name, const char *dbname, const char *type,
 
        initPQExpBuffer(&sql);
 
-       appendPQExpBuffer(&sql, "REINDEX");
+       appendPQExpBufferStr(&sql, "REINDEX");
        if (strcmp(type, "TABLE") == 0)
                appendPQExpBuffer(&sql, " TABLE %s", name);
        else if (strcmp(type, "INDEX") == 0)
                appendPQExpBuffer(&sql, " INDEX %s", name);
        else if (strcmp(type, "DATABASE") == 0)
                appendPQExpBuffer(&sql, " DATABASE %s", fmtId(name));
-       appendPQExpBuffer(&sql, ";\n");
+       appendPQExpBufferStr(&sql, ";\n");
 
        conn = connectDatabase(dbname, host, port, username, prompt_password,
                                                   progname, false);
index e4dde1fc9bf34481f226de1874ad16c31de153aa..616d9339e1ed6ed8e71fb02786757185b5cd3b13 100644 (file)
@@ -248,13 +248,13 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool and_analyz
 
        if (analyze_only)
        {
-               appendPQExpBuffer(&sql, "ANALYZE");
+               appendPQExpBufferStr(&sql, "ANALYZE");
                if (verbose)
-                       appendPQExpBuffer(&sql, " VERBOSE");
+                       appendPQExpBufferStr(&sql, " VERBOSE");
        }
        else
        {
-               appendPQExpBuffer(&sql, "VACUUM");
+               appendPQExpBufferStr(&sql, "VACUUM");
                if (PQserverVersion(conn) >= 90000)
                {
                        const char *paren = " (";
@@ -282,23 +282,23 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool and_analyz
                                sep = comma;
                        }
                        if (sep != paren)
-                               appendPQExpBuffer(&sql, ")");
+                               appendPQExpBufferStr(&sql, ")");
                }
                else
                {
                        if (full)
-                               appendPQExpBuffer(&sql, " FULL");
+                               appendPQExpBufferStr(&sql, " FULL");
                        if (freeze)
-                               appendPQExpBuffer(&sql, " FREEZE");
+                               appendPQExpBufferStr(&sql, " FREEZE");
                        if (verbose)
-                               appendPQExpBuffer(&sql, " VERBOSE");
+                               appendPQExpBufferStr(&sql, " VERBOSE");
                        if (and_analyze)
-                               appendPQExpBuffer(&sql, " ANALYZE");
+                               appendPQExpBufferStr(&sql, " ANALYZE");
                }
        }
        if (table)
                appendPQExpBuffer(&sql, " %s", table);
-       appendPQExpBuffer(&sql, ";\n");
+       appendPQExpBufferStr(&sql, ";\n");
 
        if (!executeMaintenanceCommand(conn, sql.data, echo))
        {
index 18fcb0c23724c7344f62f36adcb4f5ef9b0c73dc..8dd1a5960f6e3bb4c327cc92fbe7ef23249ddb9a 100644 (file)
@@ -1601,9 +1601,9 @@ PQconnectPoll(PGconn *conn)
                        break;
 
                default:
-                       appendPQExpBuffer(&conn->errorMessage,
-                                                         libpq_gettext(
-                                                                                       "invalid connection state, "
+                       appendPQExpBufferStr(&conn->errorMessage,
+                                                                libpq_gettext(
+                                                                                          "invalid connection state, "
                                                                 "probably indicative of memory corruption\n"
                                                                                        ));
                        goto error_return;
@@ -1695,8 +1695,8 @@ keep_going:                                               /* We will come back to here until there is
 
                                                if (usekeepalives < 0)
                                                {
-                                                       appendPQExpBuffer(&conn->errorMessage,
-                                                                                         libpq_gettext("keepalives parameter must be an integer\n"));
+                                                       appendPQExpBufferStr(&conn->errorMessage,
+                                                                                                libpq_gettext("keepalives parameter must be an integer\n"));
                                                        err = 1;
                                                }
                                                else if (usekeepalives == 0)
@@ -1920,8 +1920,8 @@ keep_going:                                               /* We will come back to here until there is
                                                 * stub
                                                 */
                                                if (errno == ENOSYS)
-                                                       appendPQExpBuffer(&conn->errorMessage,
-                                                                                         libpq_gettext("requirepeer parameter is not supported on this platform\n"));
+                                                       appendPQExpBufferStr(&conn->errorMessage,
+                                                                                                libpq_gettext("requirepeer parameter is not supported on this platform\n"));
                                                else
                                                        appendPQExpBuffer(&conn->errorMessage,
                                                                                          libpq_gettext("could not get peer credentials: %s\n"),
@@ -2084,8 +2084,8 @@ keep_going:                                               /* We will come back to here until there is
                                                                                                                 * "verify-full" */
                                                {
                                                        /* Require SSL, but server does not want it */
-                                                       appendPQExpBuffer(&conn->errorMessage,
-                                                                                         libpq_gettext("server does not support SSL, but SSL was required\n"));
+                                                       appendPQExpBufferStr(&conn->errorMessage,
+                                                                                                libpq_gettext("server does not support SSL, but SSL was required\n"));
                                                        goto error_return;
                                                }
                                                /* Otherwise, proceed with normal startup */
@@ -2470,8 +2470,8 @@ keep_going:                                               /* We will come back to here until there is
                                if (res)
                                {
                                        if (res->resultStatus != PGRES_FATAL_ERROR)
-                                               appendPQExpBuffer(&conn->errorMessage,
-                                                                                 libpq_gettext("unexpected message from server during startup\n"));
+                                               appendPQExpBufferStr(&conn->errorMessage,
+                                                                                        libpq_gettext("unexpected message from server during startup\n"));
                                        else if (conn->send_appname &&
                                                         (conn->appname || conn->fbappname))
                                        {
index 6d0c188217cf73a8c0a6917215254d699cf8dd41..3ab2971c22629d7881cb85a9b0f9747af34731b4 100644 (file)
@@ -204,7 +204,7 @@ main(int argc, char **argv)
                                                 "AND holder.granted "
                                                 "AND holder.pid <> $1 AND holder.pid IN (");
        /* The spec syntax requires at least one session; assume that here. */
-       appendPQExpBuffer(&wait_query, "%s", backend_pids[1]);
+       appendPQExpBufferStr(&wait_query, backend_pids[1]);
        for (i = 2; i < nconns; i++)
                appendPQExpBuffer(&wait_query, ", %s", backend_pids[i]);
        appendPQExpBufferStr(&wait_query,