Commit 237a0b87 authored by Peter Eisentraut's avatar Peter Eisentraut

Improve plural handling in error message

This does not use the normal plural handling, because no numbers appear
in the actual message.
parent 85f4d639
...@@ -723,7 +723,10 @@ op_error(ParseState *pstate, List *op, char oprkind, ...@@ -723,7 +723,10 @@ op_error(ParseState *pstate, List *op, char oprkind,
(errcode(ERRCODE_UNDEFINED_FUNCTION), (errcode(ERRCODE_UNDEFINED_FUNCTION),
errmsg("operator does not exist: %s", errmsg("operator does not exist: %s",
op_signature_string(op, oprkind, arg1, arg2)), op_signature_string(op, oprkind, arg1, arg2)),
errhint("No operator matches the given name and argument type(s). " (!arg1 || !arg2) ?
errhint("No operator matches the given name and argument type. "
"You might need to add an explicit type cast.") :
errhint("No operator matches the given name and argument types. "
"You might need to add explicit type casts."), "You might need to add explicit type casts."),
parser_errposition(pstate, location))); parser_errposition(pstate, location)));
} }
......
...@@ -1895,7 +1895,7 @@ alter table anothertab alter column atcol1 drop default; ...@@ -1895,7 +1895,7 @@ alter table anothertab alter column atcol1 drop default;
alter table anothertab alter column atcol1 type boolean alter table anothertab alter column atcol1 type boolean
using case when atcol1 % 2 = 0 then true else false end; -- fails using case when atcol1 % 2 = 0 then true else false end; -- fails
ERROR: operator does not exist: boolean <= integer ERROR: operator does not exist: boolean <= integer
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
alter table anothertab drop constraint anothertab_chk; alter table anothertab drop constraint anothertab_chk;
alter table anothertab drop constraint anothertab_chk; -- fails alter table anothertab drop constraint anothertab_chk; -- fails
ERROR: constraint "anothertab_chk" of relation "anothertab" does not exist ERROR: constraint "anothertab_chk" of relation "anothertab" does not exist
......
...@@ -1605,7 +1605,7 @@ select 'foo'::text = any((select array['abc','def','foo']::text[])); -- fail ...@@ -1605,7 +1605,7 @@ select 'foo'::text = any((select array['abc','def','foo']::text[])); -- fail
ERROR: operator does not exist: text = text[] ERROR: operator does not exist: text = text[]
LINE 1: select 'foo'::text = any((select array['abc','def','foo']::t... LINE 1: select 'foo'::text = any((select array['abc','def','foo']::t...
^ ^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
select 'foo'::text = any((select array['abc','def','foo']::text[])::text[]); select 'foo'::text = any((select array['abc','def','foo']::text[])::text[]);
?column? ?column?
---------- ----------
......
...@@ -107,7 +107,7 @@ SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection ...@@ -107,7 +107,7 @@ SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
ERROR: operator does not exist: lseg # point ERROR: operator does not exist: lseg # point
LINE 1: SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection LINE 1: SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
^ ^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
-- closest point -- closest point
SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest
FROM LSEG_TBL l, POINT_TBL p; FROM LSEG_TBL l, POINT_TBL p;
......
...@@ -321,7 +321,7 @@ SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time ...@@ -321,7 +321,7 @@ 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 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... LINE 1: SELECT date '1991-02-03' - time with time zone '04:05:06 UTC...
^ ^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
-- --
-- timestamp, interval arithmetic -- timestamp, interval arithmetic
-- --
......
...@@ -50,7 +50,7 @@ select 3 || 4.0; ...@@ -50,7 +50,7 @@ select 3 || 4.0;
ERROR: operator does not exist: integer || numeric ERROR: operator does not exist: integer || numeric
LINE 1: select 3 || 4.0; LINE 1: select 3 || 4.0;
^ ^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
/* /*
* various string functions * various string functions
*/ */
......
...@@ -92,4 +92,4 @@ SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TIMETZ_TBL; ...@@ -92,4 +92,4 @@ 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 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... LINE 1: SELECT f1 + time with time zone '00:01' AS "Illegal" FROM TI...
^ ^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
...@@ -166,7 +166,7 @@ SELECT n, n IS OF (int) AS is_int FROM t; ...@@ -166,7 +166,7 @@ SELECT n, n IS OF (int) AS is_int FROM t;
ERROR: operator does not exist: text + integer ERROR: operator does not exist: text + integer
LINE 4: SELECT n+1 FROM t WHERE n < 10 LINE 4: SELECT n+1 FROM t WHERE n < 10
^ ^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
-- --
-- Some examples with a tree -- Some examples with a tree
-- --
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment