Improve plural handling in error message

This does not use the normal plural handling, because no numbers appear
in the actual message.
This commit is contained in:
Peter Eisentraut 2017-08-23 13:56:59 -04:00
parent 85f4d6393d
commit 237a0b87b1
8 changed files with 11 additions and 8 deletions

View File

@ -723,7 +723,10 @@ op_error(ParseState *pstate, List *op, char oprkind,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
errmsg("operator does not exist: %s",
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."),
parser_errposition(pstate, location)));
}

View File

@ -1895,7 +1895,7 @@ 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 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; -- fails
ERROR: constraint "anothertab_chk" of relation "anothertab" does not exist

View File

@ -1605,7 +1605,7 @@ 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 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[]);
?column?
----------

View File

@ -107,7 +107,7 @@ SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
ERROR: operator does not exist: lseg # point
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
SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest
FROM LSEG_TBL l, POINT_TBL p;

View File

@ -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
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
--

View File

@ -50,7 +50,7 @@ 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 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
*/

View File

@ -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
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.

View File

@ -166,7 +166,7 @@ SELECT n, n IS OF (int) AS is_int 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 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
--