]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Simplify some log messages in extended_stats_funcs.c
authorMichael Paquier <michael@paquier.xyz>
Tue, 10 Feb 2026 07:59:19 +0000 (16:59 +0900)
committerMichael Paquier <michael@paquier.xyz>
Tue, 10 Feb 2026 07:59:19 +0000 (16:59 +0900)
The log messages used in this file applied too much quoting logic:
- No need for quote_identifier(), which is fine to not use in the
context of a log entry.
- The usual project style is to group the namespace and object together
in a quoted string, when mentioned in an log message.  This code quoted
the namespace name and the extended statistics object name separately,
which was confusing.

Reported-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/20260210.143752.1113524465620875233.horikyota.ntt@gmail.com

src/backend/statistics/extended_stats_funcs.c
src/test/regress/expected/stats_import.out

index b640941a9cc6e88114bcebad6ff9e3efa1f189c6..479f74652bef911949deb838b7b14d883ca75027 100644 (file)
@@ -347,9 +347,8 @@ extended_statistics_update(FunctionCallInfo fcinfo)
        {
                ereport(WARNING,
                                errcode(ERRCODE_UNDEFINED_OBJECT),
-                               errmsg("could not find extended statistics object \"%s\".\"%s\"",
-                                          quote_identifier(nspname),
-                                          quote_identifier(stxname)));
+                               errmsg("could not find extended statistics object \"%s.%s\"",
+                                          nspname, stxname));
                success = false;
                goto cleanup;
        }
@@ -364,11 +363,9 @@ extended_statistics_update(FunctionCallInfo fcinfo)
        {
                ereport(WARNING,
                                errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                               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)));
+                               errmsg("could not restore extended statistics object \"%s.%s\": incorrect relation \"%s.%s\" specified",
+                                          nspname, stxname,
+                                          relnspname, relname));
 
                success = false;
                goto cleanup;
@@ -420,9 +417,8 @@ 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.",
-                                               quote_identifier(nspname),
-                                               quote_identifier(stxname)));
+                               errhint("Extended statistics object \"%s.%s\" does not support statistics of this type.",
+                                               nspname, stxname));
 
                has.ndistinct = false;
                success = false;
@@ -438,9 +434,8 @@ extended_statistics_update(FunctionCallInfo fcinfo)
                                errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                errmsg("cannot specify parameter \"%s\"",
                                           extarginfo[DEPENDENCIES_ARG].argname),
-                               errhint("Extended statistics object \"%s\".\"%s\" does not support statistics of this type.",
-                                               quote_identifier(nspname),
-                                               quote_identifier(stxname)));
+                               errhint("Extended statistics object \"%s.%s\" does not support statistics of this type.",
+                                               nspname, stxname));
                has.dependencies = false;
                success = false;
        }
@@ -463,9 +458,8 @@ extended_statistics_update(FunctionCallInfo fcinfo)
                                                   extarginfo[MOST_COMMON_VALS_ARG].argname,
                                                   extarginfo[MOST_COMMON_FREQS_ARG].argname,
                                                   extarginfo[MOST_COMMON_BASE_FREQS_ARG].argname),
-                                       errhint("Extended statistics object \"%s\".\"%s\" does not support statistics of this type.",
-                                                       quote_identifier(nspname),
-                                                       quote_identifier(stxname)));
+                                       errhint("Extended statistics object \"%s.%s\" does not support statistics of this type.",
+                                                       nspname, stxname));
 
                        has.mcv = false;
                        success = false;
@@ -888,7 +882,7 @@ pg_clear_extended_stats(PG_FUNCTION_ARGS)
                table_close(pg_stext, RowExclusiveLock);
                ereport(WARNING,
                                errcode(ERRCODE_UNDEFINED_OBJECT),
-                               errmsg("could not find extended statistics object \"%s\".\"%s\"",
+                               errmsg("could not find extended statistics object \"%s.%s\"",
                                           nspname, stxname));
                PG_RETURN_VOID();
        }
@@ -904,7 +898,7 @@ 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",
+                               errmsg("could not clear extended statistics object \"%s.%s\": incorrect relation \"%s.%s\" specified",
                                           get_namespace_name(nspoid), stxname,
                                           relnspname, relname));
                PG_RETURN_VOID();
index 37131f9ceaba2c9f0cd6c4907886cd5edcf15b81..d6cc701500e80b9150bb1f92652f63d161041df3 100644 (file)
@@ -1481,7 +1481,7 @@ SELECT pg_clear_extended_stats(schemaname => 'stats_import',
   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_clear_extended_stats 
 -------------------------
  
@@ -1493,7 +1493,7 @@ SELECT pg_clear_extended_stats(schemaname => 'stats_import',
   statistics_schemaname => 'stats_import',
   statistics_name => 'test_stat_clone',
   inherited => false);
-WARNING:  could not clear extended statistics object "stats_import"."test_stat_clone": incorrect relation "stats_import"."test" specified
+WARNING:  could not clear extended statistics object "stats_import.test_stat_clone": incorrect relation "stats_import.test" specified
  pg_clear_extended_stats 
 -------------------------
  
@@ -1678,7 +1678,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
@@ -1691,7 +1691,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
@@ -1762,7 +1762,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'inherited', false,
   'n_distinct', '[{"attributes" : [1,3], "ndistinct" : 4}]'::pg_ndistinct);
 WARNING:  cannot specify parameter "n_distinct"
-HINT:  Extended statistics object "stats_import"."test_stat_dependencies" does not support statistics of this type.
+HINT:  Extended statistics object "stats_import.test_stat_dependencies" does not support statistics of this type.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1778,7 +1778,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'dependencies', '[{"attributes": [2], "dependency": 3, "degree": 1.000000},
                     {"attributes": [3], "dependency": 2, "degree": 1.000000}]'::pg_dependencies);
 WARNING:  cannot specify parameter "dependencies"
-HINT:  Extended statistics object "stats_import"."test_stat_ndistinct" does not support statistics of this type.
+HINT:  Extended statistics object "stats_import.test_stat_ndistinct" does not support statistics of this type.
  pg_restore_extended_stats 
 ---------------------------
  f
@@ -1966,7 +1966,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
   'most_common_freqs', '{0.25,0.25,0.25,0.25}'::double precision[],
   'most_common_base_freqs', '{0.0625,0.0625,0.0625,0.0625}'::double precision[]);
 WARNING:  cannot specify parameters "most_common_vals", "most_common_freqs" or "most_common_base_freqs"
-HINT:  Extended statistics object "stats_import"."test_stat_dependencies" does not support statistics of this type.
+HINT:  Extended statistics object "stats_import.test_stat_dependencies" does not support statistics of this type.
  pg_restore_extended_stats 
 ---------------------------
  f