From 4a9202a602c957ca6fc790557097e66909c895ad Mon Sep 17 00:00:00 2001
From: David Rowley <dgrowley@gmail.com>
Date: Sun, 12 Apr 2026 10:10:17 +1200
Subject: [PATCH v1 2/3] Oddities

---
 src/backend/replication/logical/conflict.c |  3 +--
 src/bin/psql/help.c                        | 23 +++++++++++-----------
 src/interfaces/libpq/fe-auth-oauth.c       | 14 +++++++++----
 3 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/src/backend/replication/logical/conflict.c b/src/backend/replication/logical/conflict.c
index 5e3f8e69e93..6ff055c88aa 100644
--- a/src/backend/replication/logical/conflict.c
+++ b/src/backend/replication/logical/conflict.c
@@ -232,8 +232,7 @@ append_tuple_value_detail(StringInfo buf, List *tuple_values,
 		first = false;
 	}
 
-	/* translator: This is the terminator of a conflict message */
-	appendStringInfoString(buf, _("."));
+	appendStringInfoChar(buf, '.');
 
 	if (need_newline)
 		appendStringInfoChar(buf, '\n');
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c
index 5e0d8f3aae1..cf17171b0fe 100644
--- a/src/bin/psql/help.c
+++ b/src/bin/psql/help.c
@@ -34,6 +34,7 @@
  */
 
 /* Some helper macros to make the code less verbose */
+#define HELPC(chr) appendPQExpBufferChar(&buf, chr)
 #define HELP0(str) appendPQExpBufferStr(&buf, _(str))
 #define HELPN(str,...) appendPQExpBuffer(&buf, _(str), __VA_ARGS__)
 #define ON(var) ((var) ? _("on") : _("off"))
@@ -178,7 +179,7 @@ slashUsage(unsigned short int pager)
 	HELP0("  \\watch [[i=]SEC] [c=N] [m=MIN]\n"
 		  "                         execute query every SEC seconds, up to N times,\n"
 		  "                         stop if less than MIN rows are returned\n");
-	HELP0("\n");
+	HELPC('\n');
 
 	HELP0("Help\n");
 
@@ -186,7 +187,7 @@ slashUsage(unsigned short int pager)
 	HELP0("  \\? options             show help on psql command-line options\n");
 	HELP0("  \\? variables           show help on special variables\n");
 	HELP0("  \\h [NAME]              help on syntax of SQL commands, * for all commands\n");
-	HELP0("\n");
+	HELPC('\n');
 
 	HELP0("Query Buffer\n");
 	HELP0("  \\e [FILE] [LINE]       edit the query buffer (or file) with external editor\n");
@@ -198,7 +199,7 @@ slashUsage(unsigned short int pager)
 	HELP0("  \\s [FILE]              display history or save it to file\n");
 #endif
 	HELP0("  \\w FILE                write query buffer to file\n");
-	HELP0("\n");
+	HELPC('\n');
 
 	HELP0("Input/Output\n");
 	HELP0("  \\copy ...              perform SQL COPY with data stream to the client host\n");
@@ -208,14 +209,14 @@ slashUsage(unsigned short int pager)
 	HELP0("  \\o [FILE]              send all query results to file or |pipe\n");
 	HELP0("  \\qecho [-n] [STRING]   write string to \\o output stream (-n for no newline)\n");
 	HELP0("  \\warn [-n] [STRING]    write string to standard error (-n for no newline)\n");
-	HELP0("\n");
+	HELPC('\n');
 
 	HELP0("Conditional\n");
 	HELP0("  \\if EXPR               begin conditional block\n");
 	HELP0("  \\elif EXPR             alternative within current conditional block\n");
 	HELP0("  \\else                  final alternative within current conditional block\n");
 	HELP0("  \\endif                 end conditional block\n");
-	HELP0("\n");
+	HELPC('\n');
 
 	HELP0("Informational\n");
 	HELP0("  (options: S = show system objects, x = expanded mode, + = additional detail)\n");
@@ -274,7 +275,7 @@ slashUsage(unsigned short int pager)
 	HELP0("  \\sf[+]   FUNCNAME      show a function's definition\n");
 	HELP0("  \\sv[+]   VIEWNAME      show a view's definition\n");
 	HELP0("  \\z[Sx]   [PATTERN]     same as \\dp\n");
-	HELP0("\n");
+	HELPC('\n');
 
 	HELP0("Large Objects\n");
 	HELP0("  \\lo_export LOBOID FILE write large object to file\n");
@@ -282,7 +283,7 @@ slashUsage(unsigned short int pager)
 		  "                         read large object from file\n");
 	HELP0("  \\lo_list[x+]           list large objects\n");
 	HELP0("  \\lo_unlink LOBOID      delete a large object\n");
-	HELP0("\n");
+	HELPC('\n');
 
 	HELP0("Formatting\n");
 	HELP0("  \\a                     toggle between unaligned and aligned output mode\n");
@@ -297,7 +298,7 @@ slashUsage(unsigned short int pager)
 	HELP0("  \\T [STRING]            set HTML <table> tag attributes, or unset if none\n");
 	HELPN("  \\x [on|off|auto]       toggle expanded output (currently %s)\n",
 		  pset.popt.topt.expanded == 2 ? _("auto") : ON(pset.popt.topt.expanded));
-	HELP0("\n");
+	HELPC('\n');
 
 	HELP0("Connection\n");
 	if (currdb)
@@ -310,7 +311,7 @@ slashUsage(unsigned short int pager)
 	HELP0("  \\conninfo              display information about current connection\n");
 	HELP0("  \\encoding [ENCODING]   show or set client encoding\n");
 	HELP0("  \\password [USERNAME]   securely change the password for a user\n");
-	HELP0("\n");
+	HELPC('\n');
 
 	HELP0("Operating System\n");
 	HELP0("  \\cd [DIR]              change the current working directory\n");
@@ -319,13 +320,13 @@ slashUsage(unsigned short int pager)
 	HELPN("  \\timing [on|off]       toggle timing of commands (currently %s)\n",
 		  ON(pset.timing));
 	HELP0("  \\! [COMMAND]           execute command in shell or start interactive shell\n");
-	HELP0("\n");
+	HELPC('\n');
 
 	HELP0("Variables\n");
 	HELP0("  \\prompt [TEXT] NAME    prompt user to set internal variable\n");
 	HELP0("  \\set [NAME [VALUE]]    set internal variable, or list all if no parameters\n");
 	HELP0("  \\unset NAME            unset (delete) internal variable\n");
-	HELP0("\n");
+	HELPC('\n');
 
 	HELP0("Extended Query Protocol\n");
 	HELP0("  \\bind [PARAM]...       set query parameters\n");
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..ab9f5660f78 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -196,6 +196,12 @@ struct json_ctx
 		(ctx)->errmsg = (ctx)->errbuf.data; \
 	} while (0)
 
+#define oauth_json_set_error_string(ctx, str) \
+	do { \
+		appendPQExpBufferStr(&(ctx)->errbuf, libpq_gettext(str)); \
+		(ctx)->errmsg = (ctx)->errbuf.data; \
+	} while (0)
+
 /* An untranslated version of oauth_json_set_error(). */
 #define oauth_json_set_error_internal(ctx, ...) \
 	do { \
@@ -219,7 +225,7 @@ oauth_json_object_start(void *state)
 
 	++ctx->nested;
 	if (ctx->nested > MAX_SASL_NESTING_LEVEL)
-		oauth_json_set_error(ctx, "JSON is too deeply nested");
+		oauth_json_set_error_string(ctx, "JSON is too deeply nested");
 
 	return oauth_json_has_error(ctx) ? JSON_SEM_ACTION_FAILED : JSON_SUCCESS;
 }
@@ -268,7 +274,7 @@ oauth_json_array_start(void *state)
 
 	if (!ctx->nested)
 	{
-		oauth_json_set_error(ctx, "top-level element must be an object");
+		oauth_json_set_error_string(ctx, "top-level element must be an object");
 	}
 	else if (ctx->target_field)
 	{
@@ -281,7 +287,7 @@ oauth_json_array_start(void *state)
 
 	++ctx->nested;
 	if (ctx->nested > MAX_SASL_NESTING_LEVEL)
-		oauth_json_set_error(ctx, "JSON is too deeply nested");
+		oauth_json_set_error_string(ctx, "JSON is too deeply nested");
 
 	return oauth_json_has_error(ctx) ? JSON_SEM_ACTION_FAILED : JSON_SUCCESS;
 }
@@ -302,7 +308,7 @@ oauth_json_scalar(void *state, char *token, JsonTokenType type)
 
 	if (!ctx->nested)
 	{
-		oauth_json_set_error(ctx, "top-level element must be an object");
+		oauth_json_set_error_string(ctx, "top-level element must be an object");
 		return JSON_SEM_ACTION_FAILED;
 	}
 
-- 
2.51.0

