From 8461424fd717877ead0706984ef9b6440b2a97ad Mon Sep 17 00:00:00 2001 From: David Rowley Date: Wed, 10 Apr 2024 11:53:32 +1200 Subject: Fixup various StringInfo function usages This adjusts various appendStringInfo* function calls to use a more appropriate and efficient function with the same behavior. For example, use appendStringInfoChar() when appending a single character rather than appendStringInfo() and appendStringInfoString() when no formatting is required rather than using appendStringInfo(). All adjustments made here are in code that's new to v17, so it makes sense to fix these now rather than wait a few years and make backpatching harder. Discussion: https://postgr.es/m/CAApHDvojY2UvMiO+9_55ArTj10P1LBNJyyoGB+C65BLDNT0GsQ@mail.gmail.com Reviewed-by: Nathan Bossart, Tom Lane --- src/backend/utils/adt/ri_triggers.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/backend/utils/adt/ri_triggers.c') diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index a2cc837ebf9..bbc2e3e2f0a 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -426,13 +426,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 */ @@ -594,13 +594,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 */ -- cgit v1.2.3