From 86bb7e9aa135cb4dbcf8ffe4cfbe473c1a003c3a Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Thu, 21 Aug 2025 17:22:06 -0400
Subject: [PATCH v3 2/4] Change the wording of our traditional
 function-not-found hint.

With the previous patch's addition of specific messages for a lot
of other error cases, it's possible to be pretty sure that the
problem is mismatched argument types rather than something else,
so we can be more specific about that.

I think this wording is clearer and follows our message style
guidelines better (by separating factual detail from hint).
However, the change causes a lot of churn in our regression test
results, and probably will do the same to extensions and other
downstream consumers.  Is it worth it?

Reported-by: Dominique Devienne <ddevienne@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1756041.1754616558@sss.pgh.pa.us
---
 doc/src/sgml/typeconv.sgml                    |  4 +-
 src/backend/parser/parse_func.c               | 13 ++--
 src/pl/plpgsql/src/expected/plpgsql_call.out  |  3 +-
 .../plpgsql/src/expected/plpgsql_record.out   |  3 +-
 src/test/regress/expected/arrays.out          |  3 +-
 src/test/regress/expected/create_cast.out     |  6 +-
 .../regress/expected/create_procedure.out     |  3 +-
 src/test/regress/expected/multirangetypes.out | 15 +++--
 src/test/regress/expected/plpgsql.out         |  6 +-
 src/test/regress/expected/polymorphism.out    | 60 ++++++++++++-------
 src/test/regress/expected/rangetypes.out      |  9 ++-
 src/test/regress/expected/rowtypes.out        |  6 +-
 src/test/regress/expected/text.out            |  3 +-
 13 files changed, 86 insertions(+), 48 deletions(-)

diff --git a/doc/src/sgml/typeconv.sgml b/doc/src/sgml/typeconv.sgml
index 28748742486..44aaf284da4 100644
--- a/doc/src/sgml/typeconv.sgml
+++ b/doc/src/sgml/typeconv.sgml
@@ -901,8 +901,8 @@ the parser will try to convert that to <type>text</type>:
 <screen>
 SELECT substr(1234, 3);
 ERROR:  function substr(integer, integer) does not exist
-HINT:  No function matches the given name and argument types. You might need
-to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 </screen>
 
 This does not work because <type>integer</type> does not have an implicit cast
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index febccb74843..f666a64999c 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -617,8 +617,8 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
 					 errmsg("function %s does not exist",
 							func_signature_string(funcname, nargs, argnames,
 												  actual_arg_types)),
-					 errhint("No aggregate function matches the given name and argument types. "
-							 "Perhaps you misplaced ORDER BY; ORDER BY must appear "
+					 errdetail("No aggregate function matches the given name and argument types."),
+					 errhint("Perhaps you misplaced ORDER BY; ORDER BY must appear "
 							 "after all regular arguments of the aggregate."),
 					 parser_errposition(pstate, location)));
 		}
@@ -988,14 +988,13 @@ func_lookup_failure_details(int fgc_flags, List *argnames, bool proc_call)
 		return errhint("The VARIADIC parameter must be placed last, even when using argument names.");
 
 	/*
-	 * Otherwise, give our traditional hint about argument types and casting.
+	 * Otherwise, the problem must be incorrect argument types.
 	 */
 	if (proc_call)
-		return errhint("No procedure matches the given name and argument types. "
-					   "You might need to add explicit type casts.");
+		(void) errdetail("No procedure of that name accepts the given argument types.");
 	else
-		return errhint("No function matches the given name and argument types. "
-					   "You might need to add explicit type casts.");
+		(void) errdetail("No function of that name accepts the given argument types.");
+	return errhint("You might need to add explicit type casts.");
 }
 
 
diff --git a/src/pl/plpgsql/src/expected/plpgsql_call.out b/src/pl/plpgsql/src/expected/plpgsql_call.out
index ea7107dca0d..3d0b117f236 100644
--- a/src/pl/plpgsql/src/expected/plpgsql_call.out
+++ b/src/pl/plpgsql/src/expected/plpgsql_call.out
@@ -440,7 +440,8 @@ $$;
 ERROR:  procedure test_proc12(integer, integer, text[]) does not exist
 LINE 1: CALL test_proc12(_a, _b, _c)
              ^
-HINT:  No procedure matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No procedure of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 QUERY:  CALL test_proc12(_a, _b, _c)
 CONTEXT:  PL/pgSQL function inline_code_block line 5 at CALL
 -- transition variable assignment
diff --git a/src/pl/plpgsql/src/expected/plpgsql_record.out b/src/pl/plpgsql/src/expected/plpgsql_record.out
index e5de7143606..511f9e03c85 100644
--- a/src/pl/plpgsql/src/expected/plpgsql_record.out
+++ b/src/pl/plpgsql/src/expected/plpgsql_record.out
@@ -466,7 +466,8 @@ select getf1(1);
 ERROR:  function getf1(integer) does not exist
 LINE 1: select getf1(1);
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 select getf1(row(1,2));
  getf1 
 -------
diff --git a/src/test/regress/expected/arrays.out b/src/test/regress/expected/arrays.out
index b815473f414..69ea2cf5ad8 100644
--- a/src/test/regress/expected/arrays.out
+++ b/src/test/regress/expected/arrays.out
@@ -2747,7 +2747,8 @@ SELECT width_bucket('5'::text, ARRAY[3, 4]::integer[]);
 ERROR:  function width_bucket(text, integer[]) does not exist
 LINE 1: SELECT width_bucket('5'::text, ARRAY[3, 4]::integer[]);
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 SELECT width_bucket(5, ARRAY[3, 4, NULL]);
 ERROR:  thresholds array must not contain NULLs
 SELECT width_bucket(5, ARRAY[ARRAY[1, 2], ARRAY[3, 4]]);
diff --git a/src/test/regress/expected/create_cast.out b/src/test/regress/expected/create_cast.out
index fd4871d94db..0e69644bca2 100644
--- a/src/test/regress/expected/create_cast.out
+++ b/src/test/regress/expected/create_cast.out
@@ -28,14 +28,16 @@ SELECT casttestfunc('foo'::text); -- fails, as there's no cast
 ERROR:  function casttestfunc(text) does not exist
 LINE 1: SELECT casttestfunc('foo'::text);
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 -- Try binary coercion cast
 CREATE CAST (text AS casttesttype) WITHOUT FUNCTION;
 SELECT casttestfunc('foo'::text); -- doesn't work, as the cast is explicit
 ERROR:  function casttestfunc(text) does not exist
 LINE 1: SELECT casttestfunc('foo'::text);
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 SELECT casttestfunc('foo'::text::casttesttype); -- should work
  casttestfunc 
 --------------
diff --git a/src/test/regress/expected/create_procedure.out b/src/test/regress/expected/create_procedure.out
index cd8a77c1ade..3090a57790d 100644
--- a/src/test/regress/expected/create_procedure.out
+++ b/src/test/regress/expected/create_procedure.out
@@ -299,7 +299,8 @@ CALL ptest9(1./0.);  -- error
 ERROR:  procedure ptest9(numeric) does not exist
 LINE 1: CALL ptest9(1./0.);
              ^
-HINT:  No procedure matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No procedure of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 -- check named-parameter matching
 CREATE PROCEDURE ptest10(OUT a int, IN b int, IN c int)
 LANGUAGE SQL AS $$ SELECT b - c $$;
diff --git a/src/test/regress/expected/multirangetypes.out b/src/test/regress/expected/multirangetypes.out
index c6363ebeb24..63de4d09b15 100644
--- a/src/test/regress/expected/multirangetypes.out
+++ b/src/test/regress/expected/multirangetypes.out
@@ -3096,7 +3096,8 @@ select multirange_of_text(textrange2('a','Z'));  -- should fail
 ERROR:  function multirange_of_text(textrange2) does not exist
 LINE 1: select multirange_of_text(textrange2('a','Z'));
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 select multirange_of_text(textrange1('a','Z')) @> 'b'::text;
 ERROR:  range lower bound must be less than or equal to range upper bound
 select unnest(multirange_of_text(textrange1('a','b'), textrange1('d','e')));
@@ -3160,7 +3161,8 @@ select anyarray_anymultirange_func(ARRAY[1,2], nummultirange(numrange(10,20)));
 ERROR:  function anyarray_anymultirange_func(integer[], nummultirange) does not exist
 LINE 1: select anyarray_anymultirange_func(ARRAY[1,2], nummultirange...
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function anyarray_anymultirange_func(anyarray, anymultirange);
 -- should fail
 create function bogus_func(anyelement)
@@ -3199,7 +3201,8 @@ select multirangetypes_sql(nummultirange(numrange(1,10)), ARRAY[2,20]);  -- matc
 ERROR:  function multirangetypes_sql(nummultirange, integer[]) does not exist
 LINE 1: select multirangetypes_sql(nummultirange(numrange(1,10)), AR...
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 create function anycompatiblearray_anycompatiblemultirange_func(a anycompatiblearray, mr anycompatiblemultirange)
   returns anycompatible as 'select $1[1] + lower($2);' language sql;
 select anycompatiblearray_anycompatiblemultirange_func(ARRAY[1,2], multirange(int4range(10,20)));
@@ -3219,7 +3222,8 @@ select anycompatiblearray_anycompatiblemultirange_func(ARRAY[1.1,2], multirange(
 ERROR:  function anycompatiblearray_anycompatiblemultirange_func(numeric[], int4multirange) does not exist
 LINE 1: select anycompatiblearray_anycompatiblemultirange_func(ARRAY...
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function anycompatiblearray_anycompatiblemultirange_func(anycompatiblearray, anycompatiblemultirange);
 create function anycompatiblerange_anycompatiblemultirange_func(r anycompatiblerange, mr anycompatiblemultirange)
   returns anycompatible as 'select lower($1) + lower($2);' language sql;
@@ -3234,7 +3238,8 @@ select anycompatiblerange_anycompatiblemultirange_func(numrange(1,2), multirange
 ERROR:  function anycompatiblerange_anycompatiblemultirange_func(numrange, int4multirange) does not exist
 LINE 1: select anycompatiblerange_anycompatiblemultirange_func(numra...
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function anycompatiblerange_anycompatiblemultirange_func(anycompatiblerange, anycompatiblemultirange);
 -- should fail
 create function bogus_func(anycompatible)
diff --git a/src/test/regress/expected/plpgsql.out b/src/test/regress/expected/plpgsql.out
index 7fd0481710c..b2aaaf10b9c 100644
--- a/src/test/regress/expected/plpgsql.out
+++ b/src/test/regress/expected/plpgsql.out
@@ -1848,7 +1848,8 @@ select f1(int4range(42, 49), 11, 4.5) as fail;  -- range type doesn't fit
 ERROR:  function f1(int4range, integer, numeric) does not exist
 LINE 1: select f1(int4range(42, 49), 11, 4.5) as fail;
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function f1(x anycompatiblerange, y anycompatible, z anycompatible);
 -- fail, can't infer type:
 create function f1(x anycompatible) returns anycompatiblerange as $$
@@ -1902,7 +1903,8 @@ select x, pg_typeof(x), y, pg_typeof(y)
 ERROR:  function f1(integer, numeric[], integer, numeric) does not exist
 LINE 2:   from f1(11, array[1, 2.2], 42, 34.5);
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function f1(a anyelement, b anyarray,
                  c anycompatible, d anycompatible);
 --
diff --git a/src/test/regress/expected/polymorphism.out b/src/test/regress/expected/polymorphism.out
index b6f5fb126fa..05b2300a46e 100644
--- a/src/test/regress/expected/polymorphism.out
+++ b/src/test/regress/expected/polymorphism.out
@@ -95,7 +95,8 @@ select polyf(int4range(42, 49), 11, 4.5) as fail;  -- range type doesn't fit
 ERROR:  function polyf(int4range, integer, numeric) does not exist
 LINE 1: select polyf(int4range(42, 49), 11, 4.5) as fail;
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function polyf(x anycompatiblerange, y anycompatible, z anycompatible);
 create function polyf(x anycompatiblemultirange, y anycompatible, z anycompatible) returns anycompatiblearray as $$
   select array[lower(x), upper(x), y, z]
@@ -110,7 +111,8 @@ select polyf(multirange(int4range(42, 49)), 11, 4.5) as fail;  -- range type doe
 ERROR:  function polyf(int4multirange, integer, numeric) does not exist
 LINE 1: select polyf(multirange(int4range(42, 49)), 11, 4.5) as fail...
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function polyf(x anycompatiblemultirange, y anycompatible, z anycompatible);
 -- fail, can't infer type:
 create function polyf(x anycompatible) returns anycompatiblerange as $$
@@ -176,7 +178,8 @@ select x, pg_typeof(x), y, pg_typeof(y)
 ERROR:  function polyf(integer, numeric[], integer, numeric) does not exist
 LINE 2:   from polyf(11, array[1, 2.2], 42, 34.5);
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function polyf(a anyelement, b anyarray,
                     c anycompatible, d anycompatible);
 create function polyf(anyrange) returns anymultirange
@@ -1060,17 +1063,20 @@ select formarray(1.1, array[1.2,55.5]); -- fail without variadic
 ERROR:  function formarray(numeric, numeric[]) does not exist
 LINE 1: select formarray(1.1, array[1.2,55.5]);
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 select formarray(1, 'x'::text); -- fail, type mismatch
 ERROR:  function formarray(integer, text) does not exist
 LINE 1: select formarray(1, 'x'::text);
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 select formarray(1, variadic array['x'::text]); -- fail, type mismatch
 ERROR:  function formarray(integer, text[]) does not exist
 LINE 1: select formarray(1, variadic array['x'::text]);
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function formarray(anyelement, variadic anyarray);
 -- test pg_typeof() function
 select pg_typeof(null);           -- unknown
@@ -1504,7 +1510,8 @@ select xleast(arr => 1, variadic x => array[2,3]);  -- mixed-up args
 ERROR:  function xleast(arr => integer, x => integer[]) does not exist
 LINE 1: select xleast(arr => 1, variadic x => array[2,3]);
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function xleast(x numeric, variadic arr numeric[]);
 -- test with different parameter types
 create function dfunc(a varchar, b numeric, c date = current_date)
@@ -1545,7 +1552,8 @@ select * from dfunc('Hello World', c := 20, b := '2009-07-25'::date);  -- fail
 ERROR:  function dfunc(unknown, c => integer, b => date) does not exist
 LINE 1: select * from dfunc('Hello World', c := 20, b := '2009-07-25...
                       ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function dfunc(varchar, numeric, date);
 -- test out parameters with named params
 create function dfunc(a varchar = 'def a', out _a varchar, c numeric = NULL, out _c numeric)
@@ -1890,7 +1898,8 @@ select x, pg_typeof(x) from anyctest(11, point(1,2)) x;  -- fail
 ERROR:  function anyctest(integer, point) does not exist
 LINE 1: select x, pg_typeof(x) from anyctest(11, point(1,2)) x;
                                     ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 select x, pg_typeof(x) from anyctest('11', '12.3') x;  -- defaults to text
   x   | pg_typeof 
 ------+-----------
@@ -1918,7 +1927,8 @@ select x, pg_typeof(x) from anyctest(11, array[1,2]) x;  -- fail
 ERROR:  function anyctest(integer, integer[]) does not exist
 LINE 1: select x, pg_typeof(x) from anyctest(11, array[1,2]) x;
                                     ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function anyctest(anycompatible, anycompatible);
 create function anyctest(anycompatible, anycompatiblearray)
 returns anycompatiblearray as $$
@@ -1952,12 +1962,14 @@ select x, pg_typeof(x) from anyctest(11, array[point(1,2)]) x;  -- fail
 ERROR:  function anyctest(integer, point[]) does not exist
 LINE 1: select x, pg_typeof(x) from anyctest(11, array[point(1,2)]) ...
                                     ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 select x, pg_typeof(x) from anyctest(11, 12) x;  -- fail
 ERROR:  function anyctest(integer, integer) does not exist
 LINE 1: select x, pg_typeof(x) from anyctest(11, 12) x;
                                     ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function anyctest(anycompatible, anycompatiblearray);
 create function anyctest(anycompatible, anycompatiblerange)
 returns anycompatiblerange as $$
@@ -1979,12 +1991,14 @@ select x, pg_typeof(x) from anyctest(11, 12) x;  -- fail
 ERROR:  function anyctest(integer, integer) does not exist
 LINE 1: select x, pg_typeof(x) from anyctest(11, 12) x;
                                     ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 select x, pg_typeof(x) from anyctest(11.2, int4range(4,7)) x;  -- fail
 ERROR:  function anyctest(numeric, int4range) does not exist
 LINE 1: select x, pg_typeof(x) from anyctest(11.2, int4range(4,7)) x...
                                     ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 select x, pg_typeof(x) from anyctest(11.2, '[4,7)') x;  -- fail
 ERROR:  could not determine polymorphic type anycompatiblerange because input has type unknown
 drop function anyctest(anycompatible, anycompatiblerange);
@@ -2002,7 +2016,8 @@ select x, pg_typeof(x) from anyctest(int4range(11,12), numrange(4,7)) x; -- fail
 ERROR:  function anyctest(int4range, numrange) does not exist
 LINE 1: select x, pg_typeof(x) from anyctest(int4range(11,12), numra...
                                     ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function anyctest(anycompatiblerange, anycompatiblerange);
 -- fail, can't infer result type:
 create function anyctest(anycompatible)
@@ -2031,12 +2046,14 @@ select x, pg_typeof(x) from anyctest(11, 12) x;  -- fail
 ERROR:  function anyctest(integer, integer) does not exist
 LINE 1: select x, pg_typeof(x) from anyctest(11, 12) x;
                                     ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 select x, pg_typeof(x) from anyctest(11.2, multirange(int4range(4,7))) x;  -- fail
 ERROR:  function anyctest(numeric, int4multirange) does not exist
 LINE 1: select x, pg_typeof(x) from anyctest(11.2, multirange(int4ra...
                                     ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 select x, pg_typeof(x) from anyctest(11.2, '{[4,7)}') x;  -- fail
 ERROR:  could not determine polymorphic type anycompatiblemultirange because input has type unknown
 drop function anyctest(anycompatible, anycompatiblemultirange);
@@ -2054,7 +2071,8 @@ select x, pg_typeof(x) from anyctest(multirange(int4range(11,12)), multirange(nu
 ERROR:  function anyctest(int4multirange, nummultirange) does not exist
 LINE 1: select x, pg_typeof(x) from anyctest(multirange(int4range(11...
                                     ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function anyctest(anycompatiblemultirange, anycompatiblemultirange);
 -- fail, can't infer result type:
 create function anyctest(anycompatible)
@@ -2083,7 +2101,8 @@ select x, pg_typeof(x) from anyctest(array[11], array[1,2]) x;  -- fail
 ERROR:  function anyctest(integer[], integer[]) does not exist
 LINE 1: select x, pg_typeof(x) from anyctest(array[11], array[1,2]) ...
                                     ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function anyctest(anycompatiblenonarray, anycompatiblenonarray);
 create function anyctest(a anyelement, b anyarray,
                          c anycompatible, d anycompatible)
@@ -2112,7 +2131,8 @@ select x, pg_typeof(x) from anyctest(11, array[1, 2.2], 42, 34.5) x;  -- fail
 ERROR:  function anyctest(integer, numeric[], integer, numeric) does not exist
 LINE 1: select x, pg_typeof(x) from anyctest(11, array[1, 2.2], 42, ...
                                     ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function anyctest(a anyelement, b anyarray,
                        c anycompatible, d anycompatible);
 create function anyctest(variadic anycompatiblearray)
diff --git a/src/test/regress/expected/rangetypes.out b/src/test/regress/expected/rangetypes.out
index a7cc220bf0d..cdd95799cd5 100644
--- a/src/test/regress/expected/rangetypes.out
+++ b/src/test/regress/expected/rangetypes.out
@@ -1630,7 +1630,8 @@ select anyarray_anyrange_func(ARRAY[1,2], numrange(10,20));
 ERROR:  function anyarray_anyrange_func(integer[], numrange) does not exist
 LINE 1: select anyarray_anyrange_func(ARRAY[1,2], numrange(10,20));
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function anyarray_anyrange_func(anyarray, anyrange);
 -- should fail
 create function bogus_func(anyelement)
@@ -1669,7 +1670,8 @@ select rangetypes_sql(numrange(1,10), ARRAY[2,20]);  -- match failure
 ERROR:  function rangetypes_sql(numrange, integer[]) does not exist
 LINE 1: select rangetypes_sql(numrange(1,10), ARRAY[2,20]);
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 create function anycompatiblearray_anycompatiblerange_func(a anycompatiblearray, r anycompatiblerange)
   returns anycompatible as 'select $1[1] + lower($2);' language sql;
 select anycompatiblearray_anycompatiblerange_func(ARRAY[1,2], int4range(10,20));
@@ -1689,7 +1691,8 @@ select anycompatiblearray_anycompatiblerange_func(ARRAY[1.1,2], int4range(10,20)
 ERROR:  function anycompatiblearray_anycompatiblerange_func(numeric[], int4range) does not exist
 LINE 1: select anycompatiblearray_anycompatiblerange_func(ARRAY[1.1,...
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 drop function anycompatiblearray_anycompatiblerange_func(anycompatiblearray, anycompatiblerange);
 -- should fail
 create function bogus_func(anycompatible)
diff --git a/src/test/regress/expected/rowtypes.out b/src/test/regress/expected/rowtypes.out
index 9168979a620..d84122881af 100644
--- a/src/test/regress/expected/rowtypes.out
+++ b/src/test/regress/expected/rowtypes.out
@@ -965,7 +965,8 @@ select text(fullname) from fullname;  -- error
 ERROR:  function text(fullname) does not exist
 LINE 1: select text(fullname) from fullname;
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 select fullname.text from fullname;  -- error
 ERROR:  column fullname.text does not exist
 LINE 1: select fullname.text from fullname;
@@ -987,7 +988,8 @@ select text(row('Jim', 'Beam'));  -- error
 ERROR:  function text(record) does not exist
 LINE 1: select text(row('Jim', 'Beam'));
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 select (row('Jim', 'Beam')).text;  -- error
 ERROR:  could not identify column "text" in record data type
 LINE 1: select (row('Jim', 'Beam')).text;
diff --git a/src/test/regress/expected/text.out b/src/test/regress/expected/text.out
index 4c65b238e76..ced71e903c6 100644
--- a/src/test/regress/expected/text.out
+++ b/src/test/regress/expected/text.out
@@ -27,7 +27,8 @@ select length(42);
 ERROR:  function length(integer) does not exist
 LINE 1: select length(42);
                ^
-HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
+DETAIL:  No function of that name accepts the given argument types.
+HINT:  You might need to add explicit type casts.
 -- But as a special exception for usability's sake, we still allow implicit
 -- casting to text in concatenations, so long as the other input is text or
 -- an unknown literal.  So these work:
-- 
2.43.7

