appendstringinfo_fixes_v2.patch
application/octet-stream
Filename: appendstringinfo_fixes_v2.patch
Type: application/octet-stream
Part: 0
Patch
Format: unified
Series: patch v2
| File | + | − |
|---|---|---|
| src/backend/access/brin/brin_minmax_multi.c | 8 | 10 |
| src/backend/access/heap/vacuumlazy.c | 4 | 4 |
| src/bin/pg_amcheck/pg_amcheck.c | 1 | 1 |
| src/bin/psql/describe.c | 3 | 3 |
diff --git a/src/backend/access/brin/brin_minmax_multi.c b/src/backend/access/brin/brin_minmax_multi.c
index bd14184d76..be7355def2 100644
--- a/src/backend/access/brin/brin_minmax_multi.c
+++ b/src/backend/access/brin/brin_minmax_multi.c
@@ -3032,19 +3032,17 @@ brin_minmax_multi_summary_out(PG_FUNCTION_ARGS)
idx = 0;
for (i = 0; i < ranges_deserialized->nranges; i++)
{
- Datum a,
- b;
+ char *a,
+ *b;
text *c;
StringInfoData str;
initStringInfo(&str);
- a = FunctionCall1(&fmgrinfo, ranges_deserialized->values[idx++]);
- b = FunctionCall1(&fmgrinfo, ranges_deserialized->values[idx++]);
+ a = OutputFunctionCall(&fmgrinfo, ranges_deserialized->values[idx++]);
+ b = OutputFunctionCall(&fmgrinfo, ranges_deserialized->values[idx++]);
- appendStringInfo(&str, "%s ... %s",
- DatumGetPointer(a),
- DatumGetPointer(b));
+ appendStringInfo(&str, "%s ... %s", a, b);
c = cstring_to_text(str.data);
@@ -3076,15 +3074,15 @@ brin_minmax_multi_summary_out(PG_FUNCTION_ARGS)
for (i = 0; i < ranges_deserialized->nvalues; i++)
{
- Datum a;
+ char *a;
text *b;
StringInfoData str;
initStringInfo(&str);
- a = FunctionCall1(&fmgrinfo, ranges_deserialized->values[idx++]);
+ a = OutputFunctionCall(&fmgrinfo, ranges_deserialized->values[idx++]);
- appendStringInfo(&str, "%s", DatumGetPointer(a));
+ appendStringInfoString(&str, a);
b = cstring_to_text(str.data);
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index ad3feb88b3..4b600e951a 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -783,18 +783,18 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
msgfmt = _(" %u pages from table (%.2f%% of total) had %lld dead item identifiers removed\n");
if (vacrel->nindexes == 0 || vacrel->num_index_scans == 0)
- appendStringInfo(&buf, _("index scan not needed:"));
+ appendStringInfoString(&buf, _("index scan not needed:"));
else
- appendStringInfo(&buf, _("index scan needed:"));
+ appendStringInfoString(&buf, _("index scan needed:"));
}
else
{
msgfmt = _(" %u pages from table (%.2f%% of total) have %lld dead item identifiers\n");
if (!vacrel->do_failsafe)
- appendStringInfo(&buf, _("index scan bypassed:"));
+ appendStringInfoString(&buf, _("index scan bypassed:"));
else
- appendStringInfo(&buf, _("index scan bypassed by failsafe:"));
+ appendStringInfoString(&buf, _("index scan bypassed by failsafe:"));
}
orig_rel_pages = vacrel->rel_pages + vacrel->pages_removed;
appendStringInfo(&buf, msgfmt,
diff --git a/src/bin/pg_amcheck/pg_amcheck.c b/src/bin/pg_amcheck/pg_amcheck.c
index 37103e18cb..6b97d635c3 100644
--- a/src/bin/pg_amcheck/pg_amcheck.c
+++ b/src/bin/pg_amcheck/pg_amcheck.c
@@ -844,7 +844,7 @@ prepare_heap_command(PQExpBuffer sql, RelationInfo *rel, PGconn *conn)
if (opts.endblock >= 0)
appendPQExpBuffer(sql, ", endblock := " INT64_FORMAT, opts.endblock);
- appendPQExpBuffer(sql, ")");
+ appendPQExpBufferChar(sql, ')');
}
/*
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index 195f8d8cd2..2abf255798 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -2934,7 +2934,7 @@ describeOneTableDetails(const char *schemaname,
if (has_some && !has_all)
{
- appendPQExpBuffer(&buf, " (");
+ appendPQExpBufferStr(&buf, " (");
/* options */
if (has_ndistinct)
@@ -2954,7 +2954,7 @@ describeOneTableDetails(const char *schemaname,
appendPQExpBuffer(&buf, "%smcv", gotone ? ", " : "");
}
- appendPQExpBuffer(&buf, ")");
+ appendPQExpBufferChar(&buf, ')');
}
appendPQExpBuffer(&buf, " ON %s FROM %s",
@@ -3577,7 +3577,7 @@ describeOneTableDetails(const char *schemaname,
child_relkind == RELKIND_PARTITIONED_INDEX)
appendPQExpBufferStr(&buf, ", PARTITIONED");
if (strcmp(PQgetvalue(result, i, 2), "t") == 0)
- appendPQExpBuffer(&buf, " (DETACH PENDING)");
+ appendPQExpBufferStr(&buf, " (DETACH PENDING)");
if (i < tuples - 1)
appendPQExpBufferChar(&buf, ',');