1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-24 14:22:24 +03:00

Improve various new-to-v18 appendStringInfo calls

Similar to 8461424fd, here we adjust a few new locations which were not
using the most suitable appendStringInfo* function for the intended
purpose.

Author: David Rowley <drowleyml@gmail.com
Discussion: https://postgr.es/m/CAApHDvqJnNjueb=Eoj8K+8n0g7nj_AcPWSiCj5RNV4fDejAfqA@mail.gmail.com
This commit is contained in:
David Rowley
2025-04-11 10:07:22 +12:00
parent 55ef7abf88
commit 928394b664
9 changed files with 30 additions and 30 deletions

View File

@ -1848,7 +1848,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
if (es->format == EXPLAIN_FORMAT_TEXT)
{
appendStringInfo(es->str, " (actual ");
appendStringInfoString(es->str, " (actual ");
if (es->timing)
appendStringInfo(es->str, "time=%.3f..%.3f ", startup_ms, total_ms);
@ -1917,7 +1917,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
if (es->format == EXPLAIN_FORMAT_TEXT)
{
ExplainIndentText(es);
appendStringInfo(es->str, "actual ");
appendStringInfoString(es->str, "actual ");
if (es->timing)
appendStringInfo(es->str, "time=%.3f..%.3f ", startup_ms, total_ms);

View File

@ -1012,7 +1012,7 @@ libpqrcv_alter_slot(WalReceiverConn *conn, const char *slotname,
*failover ? "true" : "false");
if (failover && two_phase)
appendStringInfo(&cmd, ", ");
appendStringInfoString(&cmd, ", ");
if (two_phase)
appendStringInfo(&cmd, "TWO_PHASE %s",

View File

@ -262,7 +262,7 @@ errdetail_apply_conflict(EState *estate, ResultRelInfo *relinfo,
break;
case CT_UPDATE_MISSING:
appendStringInfo(&err_detail, _("Could not find the row to be updated."));
appendStringInfoString(&err_detail, _("Could not find the row to be updated."));
break;
case CT_DELETE_ORIGIN_DIFFERS:
@ -281,7 +281,7 @@ errdetail_apply_conflict(EState *estate, ResultRelInfo *relinfo,
break;
case CT_DELETE_MISSING:
appendStringInfo(&err_detail, _("Could not find the row to be deleted."));
appendStringInfoString(&err_detail, _("Could not find the row to be deleted."));
break;
}
@ -304,7 +304,7 @@ errdetail_apply_conflict(EState *estate, ResultRelInfo *relinfo,
if (err_msg->len > 0)
appendStringInfoChar(err_msg, '\n');
appendStringInfo(err_msg, "%s", err_detail.data);
appendStringInfoString(err_msg, err_detail.data);
}
/*

View File

@ -238,7 +238,7 @@ logicalrep_get_attrs_str(LogicalRepRelation *remoterel, Bitmapset *atts)
{
attcnt++;
if (attcnt > 1)
appendStringInfo(&attsbuf, _(", "));
appendStringInfoString(&attsbuf, _(", "));
appendStringInfo(&attsbuf, _("\"%s\""), remoterel->attnames[i]);
}

View File

@ -940,15 +940,15 @@ fetch_remote_table_info(char *nspname, char *relname, LogicalRepRelation *lrel,
* Now fetch column names and types.
*/
resetStringInfo(&cmd);
appendStringInfo(&cmd,
"SELECT a.attnum,"
" a.attname,"
" a.atttypid,"
" a.attnum = ANY(i.indkey)");
appendStringInfoString(&cmd,
"SELECT a.attnum,"
" a.attname,"
" a.atttypid,"
" a.attnum = ANY(i.indkey)");
/* Generated columns can be replicated since version 18. */
if (server_version >= 180000)
appendStringInfo(&cmd, ", a.attgenerated != ''");
appendStringInfoString(&cmd, ", a.attgenerated != ''");
appendStringInfo(&cmd,
" FROM pg_catalog.pg_attribute a"

View File

@ -428,13 +428,13 @@ RI_FKey_check(TriggerData *trigdata)
{
Oid fk_type = RIAttType(fk_rel, riinfo->fk_attnums[riinfo->nkeys - 1]);
appendStringInfo(&querybuf, ") x1 HAVING ");
appendStringInfoString(&querybuf, ") x1 HAVING ");
sprintf(paramname, "$%d", riinfo->nkeys);
ri_GenerateQual(&querybuf, "",
paramname, fk_type,
riinfo->agged_period_contained_by_oper,
"pg_catalog.range_agg", ANYMULTIRANGEOID);
appendStringInfo(&querybuf, "(x1.r)");
appendStringInfoString(&querybuf, "(x1.r)");
}
/* Prepare and save the plan */
@ -597,13 +597,13 @@ ri_Check_Pk_Match(Relation pk_rel, Relation fk_rel,
{
Oid fk_type = RIAttType(fk_rel, riinfo->fk_attnums[riinfo->nkeys - 1]);
appendStringInfo(&querybuf, ") x1 HAVING ");
appendStringInfoString(&querybuf, ") x1 HAVING ");
sprintf(paramname, "$%d", riinfo->nkeys);
ri_GenerateQual(&querybuf, "",
paramname, fk_type,
riinfo->agged_period_contained_by_oper,
"pg_catalog.range_agg", ANYMULTIRANGEOID);
appendStringInfo(&querybuf, "(x1.r)");
appendStringInfoString(&querybuf, "(x1.r)");
}
/* Prepare and save the plan */
@ -838,12 +838,12 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)
/* Intersect the fk with the old pk range */
initStringInfo(&intersectbuf);
appendStringInfoString(&intersectbuf, "(");
appendStringInfoChar(&intersectbuf, '(');
ri_GenerateQual(&intersectbuf, "",
attname, fk_period_type,
riinfo->period_intersect_oper,
paramname, pk_period_type);
appendStringInfoString(&intersectbuf, ")");
appendStringInfoChar(&intersectbuf, ')');
/* Find the remaining history */
initStringInfo(&replacementsbuf);