summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorAndres Freund2018-07-22 21:58:01 +0000
committerAndres Freund2018-07-22 21:58:01 +0000
commit3522d0eaba5a976f09a48810dd25dff6ab3565df (patch)
tree15b29dcc7a13a0b03e2f195d3004047f61a1e56d /src/backend
parent04269320aed30d3e37c10ae77775954eae234d45 (diff)
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
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/utils/adt/int8.c4
-rw-r--r--src/backend/utils/adt/numutils.c12
-rw-r--r--src/backend/utils/adt/timestamp.c4
3 files changed, 10 insertions, 10 deletions
diff --git a/src/backend/utils/adt/int8.c b/src/backend/utils/adt/int8.c
index 73798e7796b..49f32a8b3dd 100644
--- a/src/backend/utils/adt/int8.c
+++ b/src/backend/utils/adt/int8.c
@@ -121,8 +121,8 @@ invalid_syntax:
if (!errorOK)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
- errmsg("invalid input syntax for integer: \"%s\"",
- str)));
+ errmsg("invalid input syntax for type %s: \"%s\"",
+ "bigint", str)));
return false;
}
diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c
index b5439f497cc..fb46f692e3a 100644
--- a/src/backend/utils/adt/numutils.c
+++ b/src/backend/utils/adt/numutils.c
@@ -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;
}
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index b98036f200b..9a481f6eb90 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -480,8 +480,8 @@ parse_sane_timezone(struct pg_tm *tm, text *zone)
if (isdigit((unsigned char) *tzname))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("invalid input syntax for numeric time zone: \"%s\"",
- tzname),
+ errmsg("invalid input syntax for type %s: \"%s\"",
+ "numeric time zone", tzname),
errhint("Numeric time zones must have \"-\" or \"+\" as first character.")));
rt = DecodeTimezone(tzname, &tz);