v1-0001-Fixup-various-StringInfo-function-usages.patch

text/plain

Filename: v1-0001-Fixup-various-StringInfo-function-usages.patch
Type: text/plain
Part: 0
Message: Fixup some StringInfo usages

Patch

Format: format-patch
Series: patch v1-0001
Subject: Fixup various StringInfo function usages
File+
contrib/postgres_fdw/deparse.c 2 2
src/backend/replication/logical/slotsync.c 1 1
src/backend/replication/logical/tablesync.c 1 1
src/backend/utils/adt/ri_triggers.c 4 4
src/backend/utils/adt/ruleutils.c 10 10
From ab6ffda29c9d1d258a8918190dc3b84cbe5efecf Mon Sep 17 00:00:00 2001
From: David Rowley <dgrowley@gmail.com>
Date: Tue, 5 Mar 2024 09:07:05 +1300
Subject: [PATCH v1] Fixup various StringInfo function usages

---
 contrib/postgres_fdw/deparse.c              |  4 ++--
 src/backend/replication/logical/slotsync.c  |  2 +-
 src/backend/replication/logical/tablesync.c |  2 +-
 src/backend/utils/adt/ri_triggers.c         |  8 ++++----
 src/backend/utils/adt/ruleutils.c           | 20 ++++++++++----------
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c
index ce765ecc90..fb590c87e6 100644
--- a/contrib/postgres_fdw/deparse.c
+++ b/contrib/postgres_fdw/deparse.c
@@ -1887,7 +1887,7 @@ deparseFromExprForRel(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel,
 				}
 
 				/* Close parentheses for EXISTS subquery */
-				appendStringInfo(&str, ")");
+				appendStringInfoChar(&str, ')');
 
 				*additional_conds = lappend(*additional_conds, str.data);
 			}
@@ -1921,7 +1921,7 @@ deparseFromExprForRel(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel,
 		 */
 		if (fpinfo->jointype == JOIN_SEMI)
 		{
-			appendStringInfo(buf, "%s", join_sql_o.data);
+			appendBinaryStringInfo(buf, join_sql_o.data, join_sql_o.len);
 		}
 		else
 		{
diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index d18e2c7342..97440cb6bf 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -1311,7 +1311,7 @@ ReplSlotSyncWorkerMain(char *startup_data, size_t startup_data_len)
 	if (cluster_name[0])
 		appendStringInfo(&app_name, "%s_%s", cluster_name, "slotsync worker");
 	else
-		appendStringInfo(&app_name, "%s", "slotsync worker");
+		appendStringInfoString(&app_name, "slotsync worker");
 
 	/*
 	 * Establish the connection to the primary server for slot
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c
index 1061d5b61b..f1a3ad5459 100644
--- a/src/backend/replication/logical/tablesync.c
+++ b/src/backend/replication/logical/tablesync.c
@@ -1154,7 +1154,7 @@ copy_table(Relation rel)
 				appendStringInfoString(&cmd, quote_identifier(lrel.attnames[i]));
 			}
 
-			appendStringInfoString(&cmd, ")");
+			appendStringInfoChar(&cmd, ')');
 		}
 
 		appendStringInfoString(&cmd, " TO STDOUT");
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c
index a2cc837ebf..bbc2e3e2f0 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 */
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 52bf87ac55..24e3514b00 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -7176,16 +7176,16 @@ get_merge_query_def(Query *query, deparse_context *context,
 		switch (action->matchKind)
 		{
 			case MERGE_WHEN_MATCHED:
-				appendStringInfo(buf, "MATCHED");
+				appendStringInfoString(buf, "MATCHED");
 				break;
 			case MERGE_WHEN_NOT_MATCHED_BY_SOURCE:
-				appendStringInfo(buf, "NOT MATCHED BY SOURCE");
+				appendStringInfoString(buf, "NOT MATCHED BY SOURCE");
 				break;
 			case MERGE_WHEN_NOT_MATCHED_BY_TARGET:
 				if (haveNotMatchedBySource)
-					appendStringInfo(buf, "NOT MATCHED BY TARGET");
+					appendStringInfoString(buf, "NOT MATCHED BY TARGET");
 				else
-					appendStringInfo(buf, "NOT MATCHED");
+					appendStringInfoString(buf, "NOT MATCHED");
 				break;
 			default:
 				elog(ERROR, "unrecognized matchKind: %d",
@@ -8850,18 +8850,18 @@ get_json_expr_options(JsonExpr *jsexpr, deparse_context *context,
 	if (jsexpr->op == JSON_QUERY_OP)
 	{
 		if (jsexpr->wrapper == JSW_CONDITIONAL)
-			appendStringInfo(context->buf, " WITH CONDITIONAL WRAPPER");
+			appendStringInfoString(context->buf, " WITH CONDITIONAL WRAPPER");
 		else if (jsexpr->wrapper == JSW_UNCONDITIONAL)
-			appendStringInfo(context->buf, " WITH UNCONDITIONAL WRAPPER");
+			appendStringInfoString(context->buf, " WITH UNCONDITIONAL WRAPPER");
 		/* The default */
 		else if (jsexpr->wrapper == JSW_NONE || jsexpr->wrapper == JSW_UNSPEC)
-			appendStringInfo(context->buf, " WITHOUT WRAPPER");
+			appendStringInfoString(context->buf, " WITHOUT WRAPPER");
 
 		if (jsexpr->omit_quotes)
-			appendStringInfo(context->buf, " OMIT QUOTES");
+			appendStringInfoString(context->buf, " OMIT QUOTES");
 		/* The default */
 		else
-			appendStringInfo(context->buf, " KEEP QUOTES");
+			appendStringInfoString(context->buf, " KEEP QUOTES");
 	}
 
 	if (jsexpr->on_empty && jsexpr->on_empty->btype != default_behavior)
@@ -10206,7 +10206,7 @@ get_rule_expr(Node *node, deparse_context *context,
 									  JSON_BEHAVIOR_NULL :
 									  JSON_BEHAVIOR_FALSE);
 
-				appendStringInfoString(buf, ")");
+				appendStringInfoChar(buf, ')');
 			}
 			break;
 
-- 
2.40.1.windows.1