diff options
Diffstat (limited to 'src/test/regress')
26 files changed, 230 insertions, 71 deletions
diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index b33e06a0d3d..a08f115b0e5 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -2041,7 +2041,8 @@ alter table anothertab alter column atcol1 drop default; alter table anothertab alter column atcol1 type boolean using case when atcol1 % 2 = 0 then true else false end; -- fails ERROR: operator does not exist: boolean <= integer -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. alter table anothertab drop constraint anothertab_chk; alter table anothertab drop constraint anothertab_chk; -- fails ERROR: constraint "anothertab_chk" of relation "anothertab" does not exist 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_function_sql.out b/src/test/regress/expected/create_function_sql.out index da112608d66..73c6730d459 100644 --- a/src/test/regress/expected/create_function_sql.out +++ b/src/test/regress/expected/create_function_sql.out @@ -304,7 +304,8 @@ CREATE FUNCTION functest_S_xx(x date) RETURNS boolean ERROR: operator does not exist: date > integer LINE 3: RETURN x > 1; ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. -- tricky parsing CREATE FUNCTION functest_S_15(x int) RETURNS boolean LANGUAGE SQL diff --git a/src/test/regress/expected/create_operator.out b/src/test/regress/expected/create_operator.out index d776d9c18c3..5c7159665e2 100644 --- a/src/test/regress/expected/create_operator.out +++ b/src/test/regress/expected/create_operator.out @@ -24,6 +24,25 @@ SELECT @#@ 24; 620448401733239439360000 (1 row) +-- Test error cases +select @@##@@ 24; -- no such operator +ERROR: operator does not exist: @@##@@ integer +LINE 1: select @@##@@ 24; + ^ +DETAIL: There is no operator of that name. +set search_path = pg_catalog; +select @#@ 24; -- wrong schema +ERROR: operator does not exist: @#@ integer +LINE 1: select @#@ 24; + ^ +DETAIL: An operator of that name exists, but it is not in the search_path. +reset search_path; +select @#@ 24.0; -- wrong data type +ERROR: operator does not exist: @#@ numeric +LINE 1: select @#@ 24.0; + ^ +DETAIL: No operator of that name accepts the given argument type. +HINT: You might need to add an explicit type cast. -- Test comments COMMENT ON OPERATOR ###### (NONE, int4) IS 'bad prefix'; ERROR: operator does not exist: ###### integer diff --git a/src/test/regress/expected/create_procedure.out b/src/test/regress/expected/create_procedure.out index 45b402e25e7..f89042cf798 100644 --- a/src/test/regress/expected/create_procedure.out +++ b/src/test/regress/expected/create_procedure.out @@ -2,7 +2,7 @@ CALL nonexistent(); -- error ERROR: procedure nonexistent() does not exist LINE 1: CALL nonexistent(); ^ -HINT: No procedure matches the given name and argument types. You might need to add explicit type casts. +DETAIL: There is no procedure of that name. CALL random(); -- error ERROR: random() is not a procedure LINE 1: CALL random(); @@ -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/create_view.out b/src/test/regress/expected/create_view.out index f551624afb3..49dd13c345c 100644 --- a/src/test/regress/expected/create_view.out +++ b/src/test/regress/expected/create_view.out @@ -1924,7 +1924,8 @@ select 'foo'::text = any((select array['abc','def','foo']::text[])); -- fail ERROR: operator does not exist: text = text[] LINE 1: select 'foo'::text = any((select array['abc','def','foo']::t... ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. select 'foo'::text = any((select array['abc','def','foo']::text[])::text[]); ?column? ---------- diff --git a/src/test/regress/expected/domain.out b/src/test/regress/expected/domain.out index b5ea707df31..62a48a523a2 100644 --- a/src/test/regress/expected/domain.out +++ b/src/test/regress/expected/domain.out @@ -415,7 +415,8 @@ select row(0,1)::dcomptype; -- fail ERROR: value for domain dcomptype violates check constraint "c1" alter type comptype alter attribute r type varchar; -- fail ERROR: operator does not exist: character varying > double precision -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. alter type comptype alter attribute r type bigint; alter type comptype drop attribute r; -- fail ERROR: cannot drop column r of composite type comptype because other objects depend on it diff --git a/src/test/regress/expected/expressions.out b/src/test/regress/expected/expressions.out index 21c54fc1989..9a3c97b15a3 100644 --- a/src/test/regress/expected/expressions.out +++ b/src/test/regress/expected/expressions.out @@ -218,7 +218,8 @@ select '(0,0)'::point in ('(0,0,0,0)'::box, point(0,0)); ERROR: operator does not exist: point = box LINE 1: select '(0,0)'::point in ('(0,0,0,0)'::box, point(0,0)); ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. -- -- Tests for ScalarArrayOpExpr with a hashfn -- diff --git a/src/test/regress/expected/geometry.out b/src/test/regress/expected/geometry.out index 8be694f46be..1d168b21cbc 100644 --- a/src/test/regress/expected/geometry.out +++ b/src/test/regress/expected/geometry.out @@ -1777,7 +1777,8 @@ SELECT p.f1, l.s, l.s # p.f1 AS intersection ERROR: operator does not exist: lseg # point LINE 1: SELECT p.f1, l.s, l.s # p.f1 AS intersection ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. -- Length SELECT s, @-@ s FROM LSEG_TBL; s | ?column? diff --git a/src/test/regress/expected/horology.out b/src/test/regress/expected/horology.out index 5ae93d8e8a5..32cf62b6741 100644 --- a/src/test/regress/expected/horology.out +++ b/src/test/regress/expected/horology.out @@ -605,7 +605,8 @@ SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time ERROR: operator does not exist: date - time with time zone LINE 1: SELECT date '1991-02-03' - time with time zone '04:05:06 UTC... ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. -- -- timestamp, interval arithmetic -- diff --git a/src/test/regress/expected/misc_functions.out b/src/test/regress/expected/misc_functions.out index c3b2b9d8603..36164a99c83 100644 --- a/src/test/regress/expected/misc_functions.out +++ b/src/test/regress/expected/misc_functions.out @@ -171,12 +171,12 @@ SELECT num_nonnulls(); ERROR: function num_nonnulls() does not exist LINE 1: SELECT num_nonnulls(); ^ -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 number of arguments. SELECT num_nulls(); ERROR: function num_nulls() does not exist LINE 1: SELECT num_nulls(); ^ -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 number of arguments. -- -- canonicalize_path() -- 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 d8ce39dba3c..474be478ce8 100644 --- a/src/test/regress/expected/plpgsql.out +++ b/src/test/regress/expected/plpgsql.out @@ -1763,7 +1763,8 @@ select f1(point(3,4)); -- fail for lack of + operator ERROR: operator does not exist: point + integer LINE 1: x + 1 ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. QUERY: x + 1 CONTEXT: PL/pgSQL function f1(anyelement) line 3 at RETURN drop function f1(x anyelement); @@ -1848,7 +1849,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 +1904,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); -- @@ -3072,7 +3075,7 @@ select shadowtest(1); ERROR: function shadowtest(integer) does not exist LINE 1: select shadowtest(1); ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. +DETAIL: There is no function of that name. reset plpgsql.extra_errors; reset plpgsql.extra_warnings; create or replace function shadowtest(f1 int) diff --git a/src/test/regress/expected/polymorphism.out b/src/test/regress/expected/polymorphism.out index 94eedfe375e..4f8447ec0d7 100644 --- a/src/test/regress/expected/polymorphism.out +++ b/src/test/regress/expected/polymorphism.out @@ -15,7 +15,8 @@ select polyf(point(3,4)); -- fail for lack of + operator ERROR: operator does not exist: point + integer LINE 2: select x + 1 ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. QUERY: select x + 1 @@ -95,7 +96,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 +112,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 +179,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 @@ -990,7 +994,7 @@ select myleast(); -- fail ERROR: function myleast() does not exist LINE 1: select myleast(); ^ -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 number of arguments. -- test with variadic call parameter select myleast(variadic array[1,2,3,4,-1]); myleast @@ -1060,17 +1064,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 @@ -1154,7 +1161,7 @@ select dfunc(10, 20, 30); -- fail ERROR: function dfunc(integer, integer, integer) does not exist LINE 1: select dfunc(10, 20, 30); ^ -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 number of arguments. drop function dfunc(); -- fail ERROR: function dfunc() does not exist drop function dfunc(int); -- fail @@ -1203,7 +1210,8 @@ select dfunc(); -- fail: which dfunc should be called? int or text ERROR: function dfunc() is not unique LINE 1: select dfunc(); ^ -HINT: Could not choose a best candidate function. You might need to add explicit type casts. +DETAIL: Could not choose a best candidate function. +HINT: You might need to add explicit type casts. select dfunc('Hi'); -- ok dfunc ----------- @@ -1242,17 +1250,20 @@ select dfunc(); -- fail ERROR: function dfunc() is not unique LINE 1: select dfunc(); ^ -HINT: Could not choose a best candidate function. You might need to add explicit type casts. +DETAIL: Could not choose a best candidate function. +HINT: You might need to add explicit type casts. select dfunc(1); -- fail ERROR: function dfunc(integer) is not unique LINE 1: select dfunc(1); ^ -HINT: Could not choose a best candidate function. You might need to add explicit type casts. +DETAIL: Could not choose a best candidate function. +HINT: You might need to add explicit type casts. select dfunc(1, 2); -- fail ERROR: function dfunc(integer, integer) is not unique LINE 1: select dfunc(1, 2); ^ -HINT: Could not choose a best candidate function. You might need to add explicit type casts. +DETAIL: Could not choose a best candidate function. +HINT: You might need to add explicit type casts. select dfunc(1, 2, 3); -- ok dfunc ------- @@ -1310,7 +1321,7 @@ select dfunc(); -- fail ERROR: function dfunc() does not exist LINE 1: select dfunc(); ^ -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 number of arguments. select dfunc(10); dfunc ------- @@ -1371,7 +1382,8 @@ select dfunc(1); -- fail ERROR: function dfunc(integer) is not unique LINE 1: select dfunc(1); ^ -HINT: Could not choose a best candidate function. You might need to add explicit type casts. +DETAIL: Could not choose a best candidate function. +HINT: You might need to add explicit type casts. -- but this works since the ambiguous functions aren't preferred anyway select dfunc('Hi'); dfunc @@ -1417,7 +1429,7 @@ select * from dfunc(0); -- fail ERROR: function dfunc(integer) does not exist LINE 1: select * from dfunc(0); ^ -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 number of arguments. select * from dfunc(1,2); a | b | c | d ---+---+---+--- @@ -1448,18 +1460,72 @@ select * from dfunc(x := 10, b := 20, c := 30); -- fail, unknown param ERROR: function dfunc(x => integer, b => integer, c => integer) does not exist LINE 1: select * from dfunc(x := 10, b := 20, c := 30); ^ -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 names. select * from dfunc(10, 10, a := 20); -- fail, a overlaps positional parameter ERROR: function dfunc(integer, integer, a => integer) does not exist LINE 1: select * from dfunc(10, 10, a := 20); ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. +DETAIL: In the closest available match, an argument was specified both positionally and by name. select * from dfunc(1,c := 2,d := 3); -- fail, no value for b ERROR: function dfunc(integer, c => integer, d => integer) does not exist LINE 1: select * from dfunc(1,c := 2,d := 3); ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. +DETAIL: In the closest available match, not all required arguments were supplied. drop function dfunc(int, int, int, int); +create function xleast(x numeric, variadic arr numeric[]) + returns numeric as $$ + select least(x, min(arr[i])) from generate_subscripts(arr, 1) g(i); +$$ language sql; +select xleast(x => 1, variadic arr => array[2,3]); + xleast +-------- + 1 +(1 row) + +select xleast(1, variadic arr => array[2,3]); + xleast +-------- + 1 +(1 row) + +set search_path = pg_catalog; +select xleast(1, variadic arr => array[2,3]); -- wrong schema +ERROR: function xleast(integer, arr => integer[]) does not exist +LINE 1: select xleast(1, variadic arr => array[2,3]); + ^ +DETAIL: A function of that name exists, but it is not in the search_path. +reset search_path; +select xleast(foo => 1, variadic arr => array[2,3]); -- wrong argument name +ERROR: function xleast(foo => integer, arr => integer[]) does not exist +LINE 1: select xleast(foo => 1, variadic arr => array[2,3]); + ^ +DETAIL: No function of that name accepts the given argument names. +select xleast(x => 1, variadic array[2,3]); -- misuse of mixed notation +ERROR: positional argument cannot follow named argument +LINE 1: select xleast(x => 1, variadic array[2,3]); + ^ +select xleast(1, variadic x => array[2,3]); -- misuse of mixed notation +ERROR: function xleast(integer, x => integer[]) does not exist +LINE 1: select xleast(1, variadic x => array[2,3]); + ^ +DETAIL: In the closest available match, an argument was specified both positionally and by name. +select xleast(arr => array[1], variadic x => 3); -- wrong arg is VARIADIC +ERROR: function xleast(arr => integer[], x => integer) does not exist +LINE 1: select xleast(arr => array[1], variadic x => 3); + ^ +HINT: The VARIADIC parameter must be placed last, even when using argument names. +select xleast(arr => array[1], x => 3); -- failed to use VARIADIC +ERROR: function xleast(arr => integer[], x => integer) does not exist +LINE 1: select xleast(arr => array[1], x => 3); + ^ +HINT: This call would be correct if the variadic array were labeled VARIADIC and placed last. +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]); + ^ +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) returns table (a varchar, b numeric, c date) as $$ @@ -1499,7 +1565,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) @@ -1844,7 +1911,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 ------+----------- @@ -1872,7 +1940,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 $$ @@ -1906,12 +1975,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 $$ @@ -1933,12 +2004,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); @@ -1956,7 +2029,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) @@ -1985,12 +2059,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); @@ -2008,7 +2084,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) @@ -2037,7 +2114,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) @@ -2066,7 +2144,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/subselect.out b/src/test/regress/expected/subselect.out index 307e5ca1f3d..76ffb2b9027 100644 --- a/src/test/regress/expected/subselect.out +++ b/src/test/regress/expected/subselect.out @@ -1175,7 +1175,8 @@ select * from int8_tbl where q1 in (select c1 from inner_text); ERROR: operator does not exist: bigint = text LINE 1: select * from int8_tbl where q1 in (select c1 from inner_tex... ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. begin; -- make an operator to allow it to succeed create function bogus_int8_text_eq(int8, text) returns boolean diff --git a/src/test/regress/expected/temp.out b/src/test/regress/expected/temp.out index 370361543b3..a50c7ae88a9 100644 --- a/src/test/regress/expected/temp.out +++ b/src/test/regress/expected/temp.out @@ -229,7 +229,7 @@ select nonempty(''); ERROR: function nonempty(unknown) does not exist LINE 1: select nonempty(''); ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. +DETAIL: There is no function of that name. select pg_temp.nonempty(''); ERROR: value for domain nonempty violates check constraint "nonempty_check" -- other syntax matches rules for tables diff --git a/src/test/regress/expected/text.out b/src/test/regress/expected/text.out index 4c65b238e76..3f9982388ba 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: @@ -48,7 +49,8 @@ select 3 || 4.0; ERROR: operator does not exist: integer || numeric LINE 1: select 3 || 4.0; ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. /* * various string functions */ diff --git a/src/test/regress/expected/time.out b/src/test/regress/expected/time.out index 4247fae9412..765adeb6e51 100644 --- a/src/test/regress/expected/time.out +++ b/src/test/regress/expected/time.out @@ -157,7 +157,8 @@ SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL; ERROR: operator is not unique: time without time zone + time without time zone LINE 1: SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL; ^ -HINT: Could not choose a best candidate operator. You might need to add explicit type casts. +DETAIL: Could not choose a best candidate operator. +HINT: You might need to add explicit type casts. -- -- test EXTRACT -- diff --git a/src/test/regress/expected/timetz.out b/src/test/regress/expected/timetz.out index cbab6cfe5d7..324b1a740e8 100644 --- a/src/test/regress/expected/timetz.out +++ b/src/test/regress/expected/timetz.out @@ -174,7 +174,8 @@ SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TIMETZ_TBL; ERROR: operator does not exist: time with time zone + time with time zone LINE 1: SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TI... ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. -- -- test EXTRACT -- diff --git a/src/test/regress/expected/with.out b/src/test/regress/expected/with.out index 26c88505140..f015e997276 100644 --- a/src/test/regress/expected/with.out +++ b/src/test/regress/expected/with.out @@ -175,7 +175,8 @@ SELECT n, pg_typeof(n) FROM t; ERROR: operator does not exist: text + integer LINE 4: SELECT n+1 FROM t WHERE n < 10 ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. -- Deeply nested WITH caused a list-munging problem in v13 -- Detection of cross-references and self-references WITH RECURSIVE w1(c1) AS diff --git a/src/test/regress/expected/xid.out b/src/test/regress/expected/xid.out index 835077e9d57..1ce7826cf90 100644 --- a/src/test/regress/expected/xid.out +++ b/src/test/regress/expected/xid.out @@ -110,22 +110,26 @@ select '1'::xid < '2'::xid; ERROR: operator does not exist: xid < xid LINE 1: select '1'::xid < '2'::xid; ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. select '1'::xid <= '2'::xid; ERROR: operator does not exist: xid <= xid LINE 1: select '1'::xid <= '2'::xid; ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. select '1'::xid > '2'::xid; ERROR: operator does not exist: xid > xid LINE 1: select '1'::xid > '2'::xid; ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. select '1'::xid >= '2'::xid; ERROR: operator does not exist: xid >= xid LINE 1: select '1'::xid >= '2'::xid; ^ -HINT: No operator matches the given name and argument types. You might need to add explicit type casts. +DETAIL: No operator of that name accepts the given argument types. +HINT: You might need to add explicit type casts. -- we want them for xid8 though select '1'::xid8 < '2'::xid8, '2'::xid8 < '2'::xid8, '2'::xid8 < '1'::xid8; ?column? | ?column? | ?column? diff --git a/src/test/regress/sql/create_operator.sql b/src/test/regress/sql/create_operator.sql index a3096f17df0..19d30e18460 100644 --- a/src/test/regress/sql/create_operator.sql +++ b/src/test/regress/sql/create_operator.sql @@ -22,6 +22,13 @@ CREATE OPERATOR #%# ( -- Test operator created above SELECT @#@ 24; +-- Test error cases +select @@##@@ 24; -- no such operator +set search_path = pg_catalog; +select @#@ 24; -- wrong schema +reset search_path; +select @#@ 24.0; -- wrong data type + -- Test comments COMMENT ON OPERATOR ###### (NONE, int4) IS 'bad prefix'; COMMENT ON OPERATOR ###### (int4, NONE) IS 'bad postfix'; diff --git a/src/test/regress/sql/polymorphism.sql b/src/test/regress/sql/polymorphism.sql index fa57db6559c..7337fd2d8f1 100644 --- a/src/test/regress/sql/polymorphism.sql +++ b/src/test/regress/sql/polymorphism.sql @@ -873,6 +873,26 @@ select * from dfunc(1,c := 2,d := 3); -- fail, no value for b drop function dfunc(int, int, int, int); +create function xleast(x numeric, variadic arr numeric[]) + returns numeric as $$ + select least(x, min(arr[i])) from generate_subscripts(arr, 1) g(i); +$$ language sql; + +select xleast(x => 1, variadic arr => array[2,3]); +select xleast(1, variadic arr => array[2,3]); + +set search_path = pg_catalog; +select xleast(1, variadic arr => array[2,3]); -- wrong schema +reset search_path; +select xleast(foo => 1, variadic arr => array[2,3]); -- wrong argument name +select xleast(x => 1, variadic array[2,3]); -- misuse of mixed notation +select xleast(1, variadic x => array[2,3]); -- misuse of mixed notation +select xleast(arr => array[1], variadic x => 3); -- wrong arg is VARIADIC +select xleast(arr => array[1], x => 3); -- failed to use VARIADIC +select xleast(arr => 1, variadic x => array[2,3]); -- mixed-up args + +drop function xleast(x numeric, variadic arr numeric[]); + -- test with different parameter types create function dfunc(a varchar, b numeric, c date = current_date) returns table (a varchar, b numeric, c date) as $$ |
