mirror of
https://github.com/postgres/postgres.git
synced 2025-04-18 13:44:19 +03:00
Fixup various new-to-v18 usages of appendPQExpBuffer
Use appendPQExpBufferStr when there are no parameters and appendPQExpBufferChar when the string length is 1. Author: David Rowley <drowleyml@gmail.com> Discussion: https://postgr.es/m/CAApHDvoARMvPeXTTC0HnpARBHn-WgVstc8XFCyMGOzvgu_1HvQ@mail.gmail.com
This commit is contained in:
parent
f3281f9f93
commit
3fae25cbb3
@ -1487,7 +1487,7 @@ start_standby_server(const struct CreateSubscriberOptions *opt, bool restricted_
|
||||
appendPQExpBuffer(pg_ctl_cmd, " -s -o \"-c sync_replication_slots=off\"");
|
||||
|
||||
/* Prevent unintended slot invalidation */
|
||||
appendPQExpBuffer(pg_ctl_cmd, " -o \"-c idle_replication_slot_timeout=0\"");
|
||||
appendPQExpBufferStr(pg_ctl_cmd, " -o \"-c idle_replication_slot_timeout=0\"");
|
||||
|
||||
if (restricted_access)
|
||||
{
|
||||
@ -1513,7 +1513,7 @@ start_standby_server(const struct CreateSubscriberOptions *opt, bool restricted_
|
||||
|
||||
/* Suppress to start logical replication if requested */
|
||||
if (restrict_logical_worker)
|
||||
appendPQExpBuffer(pg_ctl_cmd, " -o \"-c max_logical_replication_workers=0\"");
|
||||
appendPQExpBufferStr(pg_ctl_cmd, " -o \"-c max_logical_replication_workers=0\"");
|
||||
|
||||
pg_log_debug("pg_ctl command is: %s", pg_ctl_cmd->data);
|
||||
rc = system(pg_ctl_cmd->data);
|
||||
|
@ -9751,7 +9751,7 @@ determineNotNullFlags(Archive *fout, PGresult *res, int r,
|
||||
{
|
||||
*invalidnotnulloids = createPQExpBuffer();
|
||||
appendPQExpBufferChar(*invalidnotnulloids, '{');
|
||||
appendPQExpBuffer(*invalidnotnulloids, "%s", constroid);
|
||||
appendPQExpBufferStr(*invalidnotnulloids, constroid);
|
||||
}
|
||||
else
|
||||
appendPQExpBuffer(*invalidnotnulloids, ",%s", constroid);
|
||||
@ -10978,7 +10978,7 @@ dumpRelationStats_dumper(Archive *fout, const void *userArg, const TocEntry *te)
|
||||
*/
|
||||
if (rsinfo->nindAttNames == 0)
|
||||
{
|
||||
appendPQExpBuffer(out, ",\n\t'attname', ");
|
||||
appendPQExpBufferStr(out, ",\n\t'attname', ");
|
||||
appendStringLiteralAH(out, attname, fout);
|
||||
}
|
||||
else
|
||||
|
@ -2859,7 +2859,7 @@ error_return:
|
||||
}
|
||||
}
|
||||
|
||||
appendPQExpBufferStr(&conn->errorMessage, "\n");
|
||||
appendPQExpBufferChar(&conn->errorMessage, '\n');
|
||||
|
||||
return PGRES_POLLING_FAILED;
|
||||
}
|
||||
|
@ -96,8 +96,7 @@ escape_literal(PGconn *conn, PQExpBuffer target,
|
||||
escaped = PQescapeLiteral(conn, unescaped, unescaped_len);
|
||||
if (!escaped)
|
||||
{
|
||||
appendPQExpBuffer(escape_err, "%s",
|
||||
PQerrorMessage(conn));
|
||||
appendPQExpBufferStr(escape_err, PQerrorMessage(conn));
|
||||
escape_err->data[escape_err->len - 1] = 0;
|
||||
escape_err->len--;
|
||||
return false;
|
||||
@ -120,8 +119,7 @@ escape_identifier(PGconn *conn, PQExpBuffer target,
|
||||
escaped = PQescapeIdentifier(conn, unescaped, unescaped_len);
|
||||
if (!escaped)
|
||||
{
|
||||
appendPQExpBuffer(escape_err, "%s",
|
||||
PQerrorMessage(conn));
|
||||
appendPQExpBufferStr(escape_err, PQerrorMessage(conn));
|
||||
escape_err->data[escape_err->len - 1] = 0;
|
||||
escape_err->len--;
|
||||
return false;
|
||||
@ -153,8 +151,7 @@ escape_string_conn(PGconn *conn, PQExpBuffer target,
|
||||
|
||||
if (error)
|
||||
{
|
||||
appendPQExpBuffer(escape_err, "%s",
|
||||
PQerrorMessage(conn));
|
||||
appendPQExpBufferStr(escape_err, PQerrorMessage(conn));
|
||||
escape_err->data[escape_err->len - 1] = 0;
|
||||
escape_err->len--;
|
||||
return false;
|
||||
@ -514,7 +511,7 @@ test_psql_parse(pe_test_config *tc, PQExpBuffer testname,
|
||||
"#\t\t %d: scan_result: %s prompt: %u, query_buf: ",
|
||||
matches, scan_res_s(scan_result), prompt_status);
|
||||
escapify(details, query_buf->data, query_buf->len);
|
||||
appendPQExpBuffer(details, "\n");
|
||||
appendPQExpBufferChar(details, '\n');
|
||||
|
||||
matches++;
|
||||
}
|
||||
@ -566,7 +563,7 @@ test_one_vector_escape(pe_test_config *tc, const pe_test_vector *tv, const pe_te
|
||||
}
|
||||
|
||||
/* name to describe the test */
|
||||
appendPQExpBuffer(testname, ">");
|
||||
appendPQExpBufferChar(testname, '>');
|
||||
escapify(testname, tv->escape, tv->escape_len);
|
||||
appendPQExpBuffer(testname, "< - %s - %s",
|
||||
tv->client_encoding, ef->name);
|
||||
@ -575,7 +572,7 @@ test_one_vector_escape(pe_test_config *tc, const pe_test_vector *tv, const pe_te
|
||||
appendPQExpBuffer(details, "#\t input: %zd bytes: ",
|
||||
tv->escape_len);
|
||||
escapify(details, tv->escape, tv->escape_len);
|
||||
appendPQExpBufferStr(details, "\n");
|
||||
appendPQExpBufferChar(details, '\n');
|
||||
appendPQExpBuffer(details, "#\t encoding: %s\n",
|
||||
tv->client_encoding);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user