mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
Deduplicate "invalid input syntax" messages for various types.
Previously a lot of the error messages referenced the type in the error message itself. That requires that the message is translated separately for each type. Note that currently a few smallint cases continue to reference the integer, rather than smallint, type. A later patch will create a separate routine for 16bit input. Author: Andres Freund Discussion: https://postgr.es/m/20180707200158.wpqkd7rjr4jxq5g7@alap3.anarazel.de
This commit is contained in:
@@ -48,8 +48,8 @@ pg_atoi(const char *s, int size, int c)
|
||||
if (*s == 0)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
|
||||
errmsg("invalid input syntax for integer: \"%s\"",
|
||||
s)));
|
||||
errmsg("invalid input syntax for type %s: \"%s\"",
|
||||
"integer", s)));
|
||||
|
||||
errno = 0;
|
||||
l = strtol(s, &badp, 10);
|
||||
@@ -58,8 +58,8 @@ pg_atoi(const char *s, int size, int c)
|
||||
if (s == badp)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
|
||||
errmsg("invalid input syntax for integer: \"%s\"",
|
||||
s)));
|
||||
errmsg("invalid input syntax for type %s: \"%s\"",
|
||||
"integer", s)));
|
||||
|
||||
switch (size)
|
||||
{
|
||||
@@ -102,8 +102,8 @@ pg_atoi(const char *s, int size, int c)
|
||||
if (*badp && *badp != c)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
|
||||
errmsg("invalid input syntax for integer: \"%s\"",
|
||||
s)));
|
||||
errmsg("invalid input syntax for type %s: \"%s\"",
|
||||
"integer", s)));
|
||||
|
||||
return (int32) l;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user