From b78d758fb6d44aa4a5e99f9a6250cd8c57c1fe16 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Date: Mon, 9 Feb 2026 16:16:06 +0900
Subject: [PATCH 6/6] Fix double quoting in extended statistics error message

Remove extra quoting for identifiers already quoted by
quote_identifier().
---
 src/backend/statistics/extended_stats_funcs.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/backend/statistics/extended_stats_funcs.c b/src/backend/statistics/extended_stats_funcs.c
index b640941a9cc..c718ffa95c6 100644
--- a/src/backend/statistics/extended_stats_funcs.c
+++ b/src/backend/statistics/extended_stats_funcs.c
@@ -347,7 +347,7 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_UNDEFINED_OBJECT),
-				errmsg("could not find extended statistics object \"%s\".\"%s\"",
+				errmsg("could not find extended statistics object %s.%s",
 					   quote_identifier(nspname),
 					   quote_identifier(stxname)));
 		success = false;
@@ -420,7 +420,7 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 				errmsg("cannot specify parameter \"%s\"",
 					   extarginfo[NDISTINCT_ARG].argname),
-				errhint("Extended statistics object \"%s\".\"%s\" does not support statistics of this type.",
+				errhint("Extended statistics object %s.%s does not support statistics of this type.",
 						quote_identifier(nspname),
 						quote_identifier(stxname)));
 
@@ -904,9 +904,11 @@ pg_clear_extended_stats(PG_FUNCTION_ARGS)
 		table_close(pg_stext, RowExclusiveLock);
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("could not clear extended statistics object \"%s\".\"%s\": incorrect relation \"%s\".\"%s\" specified",
-					   get_namespace_name(nspoid), stxname,
-					   relnspname, relname));
+				errmsg("could not clear extended statistics object %s.%s: incorrect relation %s.%s specified",
+					   quote_identifier(get_namespace_name(nspoid)),
+					   quote_identifier(stxname),
+					   quote_identifier(relnspname),
+					   quote_identifier(relname)));
 		PG_RETURN_VOID();
 	}
 
-- 
2.47.3

