From 46b9e9710b764a16321a0a298aa5c4af1c827a74 Mon Sep 17 00:00:00 2001
From: Corey Huinker <corey.huinker@gmail.com>
Date: Thu, 22 Jan 2026 23:28:38 -0500
Subject: [PATCH v30 3/6] normalize error messages

---
 src/backend/statistics/extended_stats_funcs.c | 163 +++++++++---------
 src/test/regress/expected/stats_import.out    |  78 +++++----
 2 files changed, 121 insertions(+), 120 deletions(-)

diff --git a/src/backend/statistics/extended_stats_funcs.c b/src/backend/statistics/extended_stats_funcs.c
index e5f18c821c8..f590fab3dbf 100644
--- a/src/backend/statistics/extended_stats_funcs.c
+++ b/src/backend/statistics/extended_stats_funcs.c
@@ -174,7 +174,7 @@ text_to_float4(Datum input, const char *argname, Datum *output)
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("Expression %s element \"%s\" with is not a valid type \"%s\"",
+				errmsg("could not parse expression element \"%s\" value \"%s\": invalid type \"%s\"",
 					   argname, s, "float4"));
 		*output = (Datum) 0;
 	}
@@ -202,7 +202,7 @@ text_to_int4(Datum input, const char *argname, Datum *output)
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("Expression %s element \"%s\" with is not a valid type \"%s\"",
+				errmsg("could not parse expression element \"%s\" value \"%s\": invalid type \"%s\"",
 					   argname, s, "integer"));
 		*output = (Datum) 0;
 	}
@@ -383,21 +383,18 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 	Oid			relid;
 	Oid			locked_table = InvalidOid;
 
-	char	   *relqualname = NULL;
-	char	   *staqualname = NULL;
-
 	memset(nulls, false, sizeof(nulls));
 	memset(values, 0, sizeof(values));
 	memset(replaces, 0, sizeof(replaces));
 	memset(&enabled, 0, sizeof(enabled));
 
 	/*
-	 * Fill out the StakindFlags "has" structure based on which parameters were
-	 * provided to the function.
+	 * Fill out the StakindFlags "has" structure based on which parameters
+	 * were provided to the function.
 	 *
 	 * The MCV stats composite value is an array of record type, but this is
-	 * externally represented as four arrays that must be interleaved into
-	 * the array of records. Therefore, none of the four array values is
+	 * externally represented as four arrays that must be interleaved into the
+	 * array of records. Therefore, none of the four array values is
 	 * meaningful unless the other three are also present and in sync in terms
 	 * of array length.
 	 */
@@ -455,18 +452,13 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 	pg_stext = table_open(StatisticExtRelationId, RowExclusiveLock);
 	tup = get_pg_statistic_ext(pg_stext, nspoid, stxname);
 
-	/*
-	 * Generate qualified rel/stat names for any WARNINGs that we might emit.
-	 */
-	relqualname = quote_qualified_identifier(relnspname, relname);
-	staqualname = quote_qualified_identifier(nspname, stxname);
-
 	if (!HeapTupleIsValid(tup))
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_UNDEFINED_OBJECT),
-				errmsg("could not find extended statistics object %s",
-					   staqualname));
+				errmsg("could not find extended statistics object \"%s\".\"%s\"",
+					   quote_identifier(nspname),
+					   quote_identifier(stxname)));
 		success = false;
 		goto cleanup;
 	}
@@ -481,8 +473,12 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("could not restore extended statistics object %s: incorrect relation %s specified",
-					   staqualname, relqualname));
+				errmsg("could not restore extended statistics object "
+					   "\"%s\".\"%s\": incorrect relation \"%s\".\"%s\" specified",
+					   quote_identifier(nspname),
+					   quote_identifier(stxname),
+					   quote_identifier(relnspname),
+					   quote_identifier(relname)));
 		success = false;
 		goto cleanup;
 	}
@@ -522,8 +518,8 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 
 	/*
 	 * If the object cannot hold an MCV value, but any of the MCV parameters
-	 * are set, then issue a WARNING and ensure that we do not try to load
-	 * MCV stats later.
+	 * are set, then issue a WARNING and ensure that we do not try to load MCV
+	 * stats later.
 	 */
 	if (!enabled.mcv)
 	{
@@ -534,13 +530,13 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 		{
 			ereport(WARNING,
 					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					errmsg("Extended statitisics object %s does not expect %s statistics: ",
-						   staqualname, "MCV"),
-					errhint("Cannot specify parameters \"%s\", \"%s\", \"%s\", or \"%s\".",
-							extarginfo[MOST_COMMON_VALS_ARG].argname,
-							extarginfo[MOST_COMMON_VAL_NULLS_ARG].argname,
-							extarginfo[MOST_COMMON_FREQS_ARG].argname,
-							extarginfo[MOST_COMMON_BASE_FREQS_ARG].argname));
+					errmsg("cannot specify parameters \"%s\", \"%s\", \"%s\", or \"%s\"",
+						   extarginfo[MOST_COMMON_VALS_ARG].argname,
+						   extarginfo[MOST_COMMON_VAL_NULLS_ARG].argname,
+						   extarginfo[MOST_COMMON_FREQS_ARG].argname,
+						   extarginfo[MOST_COMMON_BASE_FREQS_ARG].argname),
+					errhint("Extended statistics object "
+							"does not support statistics of this type."));
 
 			has.mcv = false;
 			success = false;
@@ -549,8 +545,8 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 	else if (!has.mcv)
 	{
 		/*
-		 * We don't have ALL of the MCV arrays, so we should have none of them.
-		 * Warn about any that we do have.
+		 * We don't have ALL of the MCV arrays, so we should have none of
+		 * them. Warn about any that we do have.
 		 */
 		if (!PG_ARGISNULL(MOST_COMMON_VALS_ARG) ||
 			!PG_ARGISNULL(MOST_COMMON_VAL_NULLS_ARG) ||
@@ -558,12 +554,12 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 			!PG_ARGISNULL(MOST_COMMON_BASE_FREQS_ARG))
 		{
 			ereport(WARNING,
-		            errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-		            errmsg("Parameters \"%s\", \"%s\", \"%s\", and \"%s\" must all be NULL or all NOT NULL.",
-		                   extarginfo[MOST_COMMON_VALS_ARG].argname,
-		                   extarginfo[MOST_COMMON_VAL_NULLS_ARG].argname,
-		                   extarginfo[MOST_COMMON_FREQS_ARG].argname,
-		                   extarginfo[MOST_COMMON_BASE_FREQS_ARG].argname));
+					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+					errmsg("parameters \"%s\", \"%s\", \"%s\", and \"%s\" must all be NULL or all NOT NULL.",
+						   extarginfo[MOST_COMMON_VALS_ARG].argname,
+						   extarginfo[MOST_COMMON_VAL_NULLS_ARG].argname,
+						   extarginfo[MOST_COMMON_FREQS_ARG].argname,
+						   extarginfo[MOST_COMMON_BASE_FREQS_ARG].argname));
 			success = false;
 		}
 	}
@@ -573,10 +569,10 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("Extended statitisics object %s does not expect %s statistics: ",
-					   staqualname, "ndistinct"),
-				errhint("Cannot specify parameter \"%s\".",
-						extarginfo[NDISTINCT_ARG].argname));
+				errmsg("cannot specify parameter \"%s\".",
+					   extarginfo[NDISTINCT_ARG].argname),
+				errhint("Extended statistics object "
+						"does not support statistics of this type."));
 
 		has.ndistinct = false;
 		success = false;
@@ -587,10 +583,10 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("Extended statitisics object %s does not expect %s statistics: ",
-					   staqualname, "dependencies"),
-				errhint("Cannot specify parameter \"%s\".",
-						extarginfo[DEPENDENCIES_ARG].argname));
+				errmsg("cannot specify parameter \"%s\".",
+					   extarginfo[DEPENDENCIES_ARG].argname),
+				errhint("Extended statistics object "
+						"does not support statistics of this type."));
 		has.dependencies = false;
 		success = false;
 	}
@@ -600,10 +596,10 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("Extended statitisics object %s does not expect %s statistics: ",
-					   staqualname, "exprs"),
-				errhint("Cannot specify parameter \"%s\".",
-						extarginfo[EXPRESSIONS_ARG].argname));
+				errmsg("cannot specify parameter \"%s\".",
+					   extarginfo[EXPRESSIONS_ARG].argname),
+				errhint("Extended statistics object "
+						"does not support statistics of this type."));
 
 		has.expressions = false;
 		success = false;
@@ -654,9 +650,10 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 		/*
 		 * After all the positive number attnums in stxkeys come the negative
 		 * numbers (if any) which represent expressions in the order that they
-		 * appear in stxdexprs. Because the expressions are always monotonically
-		 * decreasing from -1, there is no point in looking at the values in
-		 * stxkeys, it's enough to know how many of them there are.
+		 * appear in stxdexprs. Because the expressions are always
+		 * monotonically decreasing from -1, there is no point in looking at
+		 * the values in stxkeys, it's enough to know how many of them there
+		 * are.
 		 */
 		for (int i = numattnums; i < numattrs; i++)
 		{
@@ -744,15 +741,15 @@ extended_statistics_update(FunctionCallInfo fcinfo)
 
 	if (has.mcv)
 	{
-		Datum	datum;
-		bool	val_ok = false;
+		Datum		datum;
+		bool		val_ok = false;
 
 		datum = import_mcv(PG_GETARG_ARRAYTYPE_P(MOST_COMMON_VALS_ARG),
-							PG_GETARG_ARRAYTYPE_P(MOST_COMMON_VAL_NULLS_ARG),
-							PG_GETARG_ARRAYTYPE_P(MOST_COMMON_FREQS_ARG),
-							PG_GETARG_ARRAYTYPE_P(MOST_COMMON_BASE_FREQS_ARG),
-							atttypids, atttypmods, atttypcolls, numattrs,
-							&val_ok);
+						   PG_GETARG_ARRAYTYPE_P(MOST_COMMON_VAL_NULLS_ARG),
+						   PG_GETARG_ARRAYTYPE_P(MOST_COMMON_FREQS_ARG),
+						   PG_GETARG_ARRAYTYPE_P(MOST_COMMON_BASE_FREQS_ARG),
+						   atttypids, atttypmods, atttypcolls, numattrs,
+						   &val_ok);
 
 		if (val_ok)
 		{
@@ -822,10 +819,6 @@ cleanup:
 		pfree(atttypmods);
 	if (atttypcolls != NULL)
 		pfree(atttypcolls);
-	if (relqualname != NULL)
-		pfree(relqualname);
-	if (staqualname != NULL)
-		pfree(staqualname);
 	return success;
 }
 
@@ -841,8 +834,10 @@ check_mcvlist_array(const ArrayType *arr, int argindex, int required_ndims,
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("could not use parameter \"%s\": expected array of %d dimensions",
-					   extarginfo[argindex].argname, required_ndims));
+				errmsg("malformed array \"%s\": incorect number of dimensions (%d required)",
+					   extarginfo[argindex].argname, required_ndims),
+				errhint("Expected an array of as many dimensions as the "
+						"extended statistics object."));
 		return false;
 	}
 
@@ -850,7 +845,7 @@ check_mcvlist_array(const ArrayType *arr, int argindex, int required_ndims,
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("could not use array \"%s\": NULL value found",
+				errmsg("malformed array \"%s\": NULL value found",
 					   extarginfo[argindex].argname));
 		return false;
 	}
@@ -859,7 +854,7 @@ check_mcvlist_array(const ArrayType *arr, int argindex, int required_ndims,
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("could not use parameter \"%s\": incorrect number of elements (same as \"%s\" required)",
+				errmsg("malformed array \"%s\": incorrect number of elements (same as \"%s\" required)",
 					   extarginfo[argindex].argname,
 					   extarginfo[MOST_COMMON_VALS_ARG].argname));
 		return false;
@@ -895,15 +890,15 @@ import_mcv(const ArrayType *mcv_arr, const ArrayType *nulls_arr,
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("Could not use parameter \"%s\": expected text array of 2 dimensions",
-					   extarginfo[MOST_COMMON_VALS_ARG].argname));
+				errmsg("malformed array \"%s\": incorect number of dimensions (%d required)",
+					   extarginfo[MOST_COMMON_VALS_ARG].argname, 2));
 
 		goto mcv_error;
 	}
 
 	/*
-	 * All four arrays must be of the same length and cannot contain NULLs.
-	 * We use mcv_arr as the reference array for determining the length.
+	 * All four arrays must be of the same length and cannot contain NULLs. We
+	 * use mcv_arr as the reference array for determining the length.
 	 */
 	nitems = ARR_DIMS(mcv_arr)[0];
 	if (!check_mcvlist_array(nulls_arr, MOST_COMMON_VAL_NULLS_ARG,
@@ -957,29 +952,29 @@ import_expressions(Relation pgsd, int numexprs,
 	Oid			pgstypoid = get_rel_type_id(StatisticRelationId);
 
 	ArrayBuildState *astate = NULL;
-	Datum result = (Datum) 0;
+	Datum		result = (Datum) 0;
 
 	*ok = false;
 
-	/*
-	 * Verify that the exprs_array is something that matches the expectations
-	 * set by stxdexprs generally and the specific statistics object
-	 * definition.
-	 */
+	/* Overall array must be 2-D */
 	if (ARR_NDIM(exprs_arr) != 2)
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("could not use parameter \"%s\" due to incorrect dimension (2 required)",
+				errmsg("malformed array \"%s\": expected text array of 2 dimensions",
 					   extarginfo[EXPRESSIONS_ARG].argname));
 		goto exprs_error;
 	}
 
+	/*
+	 * The outer array must be equal in length to the number of expression
+	 * nodes found in pg_statistic_ext.stxexprs.
+	 */
 	if (ARR_DIMS(exprs_arr)[0] != numexprs)
 	{
 		ereport(WARNING,
 				errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				errmsg("could not use parameter \"%s\" due to incorrect outer dimension with %d elements",
+				errmsg("malformed array \"%s\": incorect number of dimensions (%d required)",
 					   extarginfo[EXPRESSIONS_ARG].argname, numexprs));
 		goto exprs_error;
 	}
@@ -1102,9 +1097,10 @@ import_expressions(Relation pgsd, int numexprs,
 		{
 			ereport(WARNING,
 					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					errmsg("could not use expressions %s and %s: conflicting NULL/NOT NULL",
+					errmsg("invalid expression elements %s and %s: conflicting NULL/NOT NULL",
 						   extexprarginfo[MOST_COMMON_VALS_ELEM].argname,
-						   extexprarginfo[MOST_COMMON_FREQS_ELEM].argname));
+						   extexprarginfo[MOST_COMMON_FREQS_ELEM].argname),
+					errhint("The elements must both be NULL or both NOT NULL."));
 			goto exprs_error;
 		}
 
@@ -1162,7 +1158,7 @@ import_expressions(Relation pgsd, int numexprs,
 			Datum		stanumbers;
 
 			if (!text_to_float4(exprs_elems[correlation_idx],
-							    extexprarginfo[CORRELATION_ELEM].argname,
+								extexprarginfo[CORRELATION_ELEM].argname,
 								&corr[0]))
 				goto exprs_error;
 
@@ -1182,9 +1178,10 @@ import_expressions(Relation pgsd, int numexprs,
 		{
 			ereport(WARNING,
 					errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-					errmsg("could not use expressions %s and %s: conflicting NULL and NOT NULL",
+					errmsg("invalid expression elements %s and %s: conflicting NULL/NOT NULL",
 						   extexprarginfo[MOST_COMMON_ELEMS_ELEM].argname,
-						   extexprarginfo[MOST_COMMON_ELEM_FREQS_ELEM].argname));
+						   extexprarginfo[MOST_COMMON_ELEM_FREQS_ELEM].argname),
+					errhint("The elements must both be NULL or both NOT NULL."));
 			goto exprs_error;
 		}
 
diff --git a/src/test/regress/expected/stats_import.out b/src/test/regress/expected/stats_import.out
index 0ad2287423f..954812d2dee 100644
--- a/src/test/regress/expected/stats_import.out
+++ b/src/test/regress/expected/stats_import.out
@@ -1644,7 +1644,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_schemaname', 'stats_import',
   'statistics_name', 'ext_stats_not_exist',
   'inherited', false);
-WARNING:  could not find extended statistics object stats_import.ext_stats_not_exist
+WARNING:  could not find extended statistics object "stats_import"."ext_stats_not_exist"
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1657,7 +1657,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_schemaname', 'stats_import',
   'statistics_name', 'test_stat_clone',
   'inherited', false);
-WARNING:  could not restore extended statistics object stats_import.test_stat_clone: incorrect relation stats_import.test specified
+WARNING:  could not restore extended statistics object "stats_import"."test_stat_clone": incorrect relation "stats_import"."test" specified
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1671,8 +1671,8 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_dependencies',
   'inherited', false,
   'n_distinct', '[{"attributes" : [2,3], "ndistinct" : 4}]'::pg_ndistinct);
-WARNING:  Extended statitisics object stats_import.test_stat_dependencies does not expect ndistinct statistics: 
-HINT:  Cannot specify parameter "n_distinct".
+WARNING:  cannot specify parameter "n_distinct".
+HINT:  Extended statistics object does not support statistics of this type.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1687,8 +1687,8 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'inherited', false,
   'dependencies', '[{"attributes": [2], "dependency": 3, "degree": 1.000000},
                     {"attributes": [3], "dependency": 2, "degree": 1.000000}]'::pg_dependencies);
-WARNING:  Extended statitisics object stats_import.test_stat_ndistinct does not expect dependencies statistics: 
-HINT:  Cannot specify parameter "dependencies".
+WARNING:  cannot specify parameter "dependencies".
+HINT:  Extended statistics object does not support statistics of this type.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1705,8 +1705,8 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'most_common_val_nulls', '{{f,t,f,t},{f,f,f,f},{f,f,f,f},{f,f,f,f}}'::boolean[],
   'most_common_freqs', '{0.25,0.25,0.25,0.25}'::double precision[],
   'most_common_base_freqs', '{0.00390625,0.015625,0.00390625,0.015625}'::double precision[]);
-WARNING:  Extended statitisics object stats_import.test_stat_ndistinct does not expect MCV statistics: 
-HINT:  Cannot specify parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", or "most_common_base_freqs".
+WARNING:  cannot specify parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", or "most_common_base_freqs"
+HINT:  Extended statistics object does not support statistics of this type.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1719,8 +1719,8 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_ndistinct',
   'inherited', false,
   'most_common_vals', '{{four,NULL,0,NULL},{one,"(1,1.1,ONE,01-01-2001,\"{\"\"xkey\"\": \"\"xval\"\"}\")",1,2},{tre,"(3,3.3,TRE,03-03-2003,)",-1,3},{two,"(2,2.2,TWO,02-02-2002,\"[true, 4, \"\"six\"\"]\")",1,2}}'::text[]);
-WARNING:  Extended statitisics object stats_import.test_stat_ndistinct does not expect MCV statistics: 
-HINT:  Cannot specify parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", or "most_common_base_freqs".
+WARNING:  cannot specify parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", or "most_common_base_freqs"
+HINT:  Extended statistics object does not support statistics of this type.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1733,8 +1733,8 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_ndistinct',
   'inherited', false,
   'most_common_val_nulls', '{{f,t,f,t},{f,f,f,f},{f,f,f,f},{f,f,f,f}}'::boolean[]);
-WARNING:  Extended statitisics object stats_import.test_stat_ndistinct does not expect MCV statistics: 
-HINT:  Cannot specify parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", or "most_common_base_freqs".
+WARNING:  cannot specify parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", or "most_common_base_freqs"
+HINT:  Extended statistics object does not support statistics of this type.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1747,8 +1747,8 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_ndistinct',
   'inherited', false,
   'most_common_freqs', '{0.25,0.25,0.25,0.25}'::double precision[]);
-WARNING:  Extended statitisics object stats_import.test_stat_ndistinct does not expect MCV statistics: 
-HINT:  Cannot specify parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", or "most_common_base_freqs".
+WARNING:  cannot specify parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", or "most_common_base_freqs"
+HINT:  Extended statistics object does not support statistics of this type.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1761,8 +1761,8 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_ndistinct',
   'inherited', false,
   'most_common_base_freqs', '{0.00390625,0.015625,0.00390625,0.015625}'::double precision[]);
-WARNING:  Extended statitisics object stats_import.test_stat_ndistinct does not expect MCV statistics: 
-HINT:  Cannot specify parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", or "most_common_base_freqs".
+WARNING:  cannot specify parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", or "most_common_base_freqs"
+HINT:  Extended statistics object does not support statistics of this type.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1776,8 +1776,8 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_ndistinct',
   'inherited', false,
   'exprs', '{{0,4,-0.75,"{1}","{0.5}","{-1,0}",-0.6,NULL,NULL,NULL},{0.25,4,-0.5,"{2}","{0.5}",NULL,1,NULL,NULL,NULL}}'::text[]);
-WARNING:  Extended statitisics object stats_import.test_stat_ndistinct does not expect exprs statistics: 
-HINT:  Cannot specify parameter "exprs".
+WARNING:  cannot specify parameter "exprs".
+HINT:  Extended statistics object does not support statistics of this type.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1823,7 +1823,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'most_common_val_nulls', '{{f,t,f,t},{f,f,f,f},{f,f,f,f},{f,f,f,f}}'::boolean[],
   'most_common_freqs', '{0.25,0.25,0.25,0.25}'::double precision[],
   'most_common_base_freqs', '{0.00390625,0.015625,0.00390625,0.015625}'::double precision[]);
-WARNING:  Could not use parameter "most_common_vals": expected text array of 2 dimensions
+WARNING:  malformed array "most_common_vals": incorect number of dimensions (2 required)
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1840,7 +1840,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'most_common_val_nulls', '{{f,t,f,t},{f,f,f,f},{f,f,f,f},{f,f,f,f}}'::boolean[],
   'most_common_freqs', '{0.25,0.25,0.25,0.25}'::double precision[],
   'most_common_base_freqs', '{0.00390625,0.015625,0.00390625,0.015625}'::double precision[]);
-WARNING:  could not use parameter "most_common_val_nulls": incorrect number of elements (same as "most_common_vals" required)
+WARNING:  malformed array "most_common_val_nulls": incorrect number of elements (same as "most_common_vals" required)
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1857,7 +1857,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'most_common_val_nulls', '{{f,f,f,f},{f,f,f,f},{f,f,f,f}}'::boolean[],
   'most_common_freqs', '{0.25,0.25,0.25,0.25}'::double precision[],
   'most_common_base_freqs', '{0.00390625,0.015625,0.00390625,0.015625}'::double precision[]);
-WARNING:  could not use parameter "most_common_val_nulls": incorrect number of elements (same as "most_common_vals" required)
+WARNING:  malformed array "most_common_val_nulls": incorrect number of elements (same as "most_common_vals" required)
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1874,7 +1874,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'most_common_val_nulls', '{{f,t,f,t},{f,f,f,f},{f,f,f,f},{f,f,f,f}}'::boolean[],
   'most_common_freqs', '{0.25,0.25,0.25}'::double precision[],
   'most_common_base_freqs', '{0.00390625,0.015625,0.00390625,0.015625}'::double precision[]);
-WARNING:  could not use parameter "most_common_freqs": incorrect number of elements (same as "most_common_vals" required)
+WARNING:  malformed array "most_common_freqs": incorrect number of elements (same as "most_common_vals" required)
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1891,7 +1891,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'most_common_val_nulls', '{{f,t,f,t},{f,f,f,f},{f,f,f,f},{f,f,f,f}}'::boolean[],
   'most_common_freqs', '{0.25,0.25,0.25,0.25}'::double precision[],
   'most_common_base_freqs', '{0.015625,0.00390625,0.015625}'::double precision[]);
-WARNING:  could not use parameter "most_common_base_freqs": incorrect number of elements (same as "most_common_vals" required)
+WARNING:  malformed array "most_common_base_freqs": incorrect number of elements (same as "most_common_vals" required)
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1905,7 +1905,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_clone',
   'inherited', false,
   'exprs', '{0,4,-0.75,"{1}","{0.5}","{-1,0}",-0.6,NULL,NULL,NULL}'::text[]);
-WARNING:  could not use parameter "exprs" due to incorrect dimension (2 required)
+WARNING:  malformed array "exprs": expected text array of 2 dimensions
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1919,7 +1919,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_clone',
   'inherited', false,
   'exprs', '{{0,4,-0.75,"{1}","{0.5}","{-1,0}",-0.6,NULL,NULL,NULL}}'::text[]);
-WARNING:  could not use parameter "exprs" due to incorrect outer dimension with 2 elements
+WARNING:  malformed array "exprs": incorect number of dimensions (2 required)
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1947,7 +1947,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_clone',
   'inherited', false,
   'exprs', '{{BADNULLFRAC,4,-0.75,"{1}","{0.5}","{-1,0}",-0.6,NULL,NULL,NULL},{0.25,4,-0.5,"{2}","{0.5}",NULL,1,NULL,NULL,NULL}}'::text[]);
-WARNING:  Expression null_frac element "BADNULLFRAC" with is not a valid type "float4"
+WARNING:  could not parse expression element "null_frac" value "BADNULLFRAC": invalid type "float4"
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1961,7 +1961,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_clone',
   'inherited', false,
   'exprs', '{{0,BADAVGWIDTH,-0.75,"{1}","{0.5}","{-1,0}",-0.6,NULL,NULL,NULL},{0.25,4,-0.5,"{2}","{0.5}",NULL,1,NULL,NULL,NULL}}'::text[]);
-WARNING:  Expression avg_width element "BADAVGWIDTH" with is not a valid type "integer"
+WARNING:  could not parse expression element "avg_width" value "BADAVGWIDTH": invalid type "integer"
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1975,7 +1975,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_clone',
   'inherited', false,
   'exprs', '{{0,4,BADNDISTINCT,"{1}","{0.5}","{-1,0}",-0.6,NULL,NULL,NULL},{0.25,4,-0.5,"{2}","{0.5}",NULL,1,NULL,NULL,NULL}}'::text[]);
-WARNING:  Expression n_distinct element "BADNDISTINCT" with is not a valid type "float4"
+WARNING:  could not parse expression element "n_distinct" value "BADNDISTINCT": invalid type "float4"
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1989,7 +1989,8 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_clone',
   'inherited', false,
   'exprs', '{{0,4,-0.75,"{1}",NULL,"{-1,0}",-0.6,NULL,NULL,NULL},{0.25,4,-0.5,"{2}","{0.5}",NULL,1,NULL,NULL,NULL}}'::text[]);
-WARNING:  could not use expressions most_common_vals and most_common_freqs: conflicting NULL/NOT NULL
+WARNING:  invalid expression elements most_common_vals and most_common_freqs: conflicting NULL/NOT NULL
+HINT:  The elements must both be NULL or both NOT NULL.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -2002,7 +2003,8 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_clone',
   'inherited', false,
   'exprs', '{{0,4,-0.75,NULL,"{0.5}","{-1,0}",-0.6,NULL,NULL,NULL},{0.25,4,-0.5,"{2}","{0.5}",NULL,1,NULL,NULL,NULL}}'::text[]);
-WARNING:  could not use expressions most_common_vals and most_common_freqs: conflicting NULL/NOT NULL
+WARNING:  invalid expression elements most_common_vals and most_common_freqs: conflicting NULL/NOT NULL
+HINT:  The elements must both be NULL or both NOT NULL.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -2058,7 +2060,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_clone',
   'inherited', false,
   'exprs', '{{0,4,-0.75,"{1}","{0.5}","{-1,0}",BADCORR,NULL,NULL,NULL},{0.25,4,-0.5,"{2}","{0.5}",NULL,1,NULL,NULL,NULL}}'::text[]);
-WARNING:  Expression correlation element "BADCORR" with is not a valid type "float4"
+WARNING:  could not parse expression element "correlation" value "BADCORR": invalid type "float4"
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -2072,7 +2074,8 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_mcelm',
   'inherited', false,
   'exprs', '{{0,33,-1,NULL,NULL,"{\"{1,1}\",\"{2,1}\",\"{3,-1}\",\"{NULL,0}\"}",1,"{-1,0,1,2,3}",NULL,"{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1.5}"}}'::text[]);
-WARNING:  could not use expressions most_common_elems and most_common_elem_freqs: conflicting NULL and NOT NULL
+WARNING:  invalid expression elements most_common_elems and most_common_elem_freqs: conflicting NULL/NOT NULL
+HINT:  The elements must both be NULL or both NOT NULL.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -2085,7 +2088,8 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_mcelm',
   'inherited', false,
   'exprs', '{{0,33,-1,NULL,NULL,"{\"{1,1}\",\"{2,1}\",\"{3,-1}\",\"{NULL,0}\"}",1,NULL,"{0.25,0.25,0.5,0.25,0.25,0.25,0.5,0.25}","{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1.5}"}}'::text[]);
-WARNING:  could not use expressions most_common_elems and most_common_elem_freqs: conflicting NULL and NOT NULL
+WARNING:  invalid expression elements most_common_elems and most_common_elem_freqs: conflicting NULL/NOT NULL
+HINT:  The elements must both be NULL or both NOT NULL.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -2435,7 +2439,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_clone',
   'inherited', false,
   'most_common_vals', '{{four,NULL,0,NULL},{one,"(1,1.1,ONE,01-01-2001,\"{\"\"xkey\"\": \"\"xval\"\"}\")",1,2},{tre,"(3,3.3,TRE,03-03-2003,)",-1,3},{two,"(2,2.2,TWO,02-02-2002,\"[true, 4, \"\"six\"\"]\")",1,2}}'::text[]);
-WARNING:  Parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", and "most_common_base_freqs" must all be NULL or all NOT NULL.
+WARNING:  parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", and "most_common_base_freqs" must all be NULL or all NOT NULL.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -2449,7 +2453,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_clone',
   'inherited', false,
   'most_common_val_nulls', '{{f,t,f,t},{f,f,f,f},{f,f,f,f},{f,f,f,f}}'::boolean[]);
-WARNING:  Parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", and "most_common_base_freqs" must all be NULL or all NOT NULL.
+WARNING:  parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", and "most_common_base_freqs" must all be NULL or all NOT NULL.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -2463,7 +2467,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_clone',
   'inherited', false,
   'most_common_freqs', '{0.25,0.25,0.25,0.25}'::double precision[]);
-WARNING:  Parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", and "most_common_base_freqs" must all be NULL or all NOT NULL.
+WARNING:  parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", and "most_common_base_freqs" must all be NULL or all NOT NULL.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -2477,7 +2481,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'statistics_name', 'test_stat_clone',
   'inherited', false,
   'most_common_base_freqs', '{0.00390625,0.015625,0.00390625,0.015625}'::double precision[]);
-WARNING:  Parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", and "most_common_base_freqs" must all be NULL or all NOT NULL.
+WARNING:  parameters "most_common_vals", "most_common_val_nulls", "most_common_freqs", and "most_common_base_freqs" must all be NULL or all NOT NULL.
  pg_restore_extended_stats 
 ---------------------------
  f
-- 
2.52.0

