summaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_coerce.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2017-01-18 16:08:20 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2017-01-18 16:08:20 -0300
commit9a34123bc315e55b33038464422ef1cd2b67dab2 (patch)
tree9b1e2e9189e7b60e7eb2876e365c5a950a6aa228 /src/backend/parser/parse_coerce.c
parent716c7d4b242f0a64ad8ac4dc48c6fed6557ba12c (diff)
Make messages mentioning type names more uniform
This avoids additional translatable strings for each distinct type, as well as making our quoting style around type names more consistent (namely, that we don't quote type names). This continues what started as f402b9950120. Discussion: https://postgr.es/m/20160401170642.GA57509@alvherre.pgsql
Diffstat (limited to 'src/backend/parser/parse_coerce.c')
-rw-r--r--src/backend/parser/parse_coerce.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 29278cf4fa5..2a2ac321573 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -1077,8 +1077,9 @@ coerce_to_boolean(ParseState *pstate, Node *node,
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
/* translator: first %s is name of a SQL construct, eg WHERE */
- errmsg("argument of %s must be type boolean, not type %s",
- constructName, format_type_be(inputTypeId)),
+ errmsg("argument of %s must be type %s, not type %s",
+ constructName, "boolean",
+ format_type_be(inputTypeId)),
parser_errposition(pstate, exprLocation(node))));
node = newnode;
}
@@ -1695,8 +1696,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (!OidIsValid(array_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("argument declared \"anyarray\" is not an array but type %s",
- format_type_be(array_typeid))));
+ errmsg("argument declared %s is not an array but type %s",
+ "anyarray", format_type_be(array_typeid))));
}
if (!OidIsValid(elem_typeid))
@@ -1711,7 +1712,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
/* otherwise, they better match */
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("argument declared \"anyarray\" is not consistent with argument declared \"anyelement\""),
+ errmsg("argument declared %s is not consistent with argument declared %s",
+ "anyarray", "anyelement"),
errdetail("%s versus %s",
format_type_be(array_typeid),
format_type_be(elem_typeid))));
@@ -1732,8 +1734,9 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (!OidIsValid(range_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("argument declared \"anyrange\" is not a range type but type %s",
- format_type_be(range_typeid))));
+ errmsg("argument declared %s is not a range type but type %s",
+ "anyrange",
+ format_type_be(range_typeid))));
}
if (!OidIsValid(elem_typeid))
@@ -1748,7 +1751,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
/* otherwise, they better match */
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("argument declared \"anyrange\" is not consistent with argument declared \"anyelement\""),
+ errmsg("argument declared %s is not consistent with argument declared %s",
+ "anyrange", "anyelement"),
errdetail("%s versus %s",
format_type_be(range_typeid),
format_type_be(elem_typeid))));
@@ -1768,7 +1772,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
/* Only way to get here is if all the generic args are UNKNOWN */
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("could not determine polymorphic type because input has type \"unknown\"")));
+ errmsg("could not determine polymorphic type because input has type %s",
+ "unknown")));
}
}
@@ -1906,8 +1911,8 @@ resolve_generic_type(Oid declared_type,
if (!OidIsValid(array_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("argument declared \"anyarray\" is not an array but type %s",
- format_type_be(context_base_type))));
+ errmsg("argument declared %s is not an array but type %s",
+ "anyarray", format_type_be(context_base_type))));
return context_base_type;
}
else if (context_declared_type == ANYELEMENTOID ||
@@ -1940,8 +1945,8 @@ resolve_generic_type(Oid declared_type,
if (!OidIsValid(array_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("argument declared \"anyarray\" is not an array but type %s",
- format_type_be(context_base_type))));
+ errmsg("argument declared %s is not an array but type %s",
+ "anyarray", format_type_be(context_base_type))));
return array_typelem;
}
else if (context_declared_type == ANYRANGEOID)
@@ -1953,8 +1958,8 @@ resolve_generic_type(Oid declared_type,
if (!OidIsValid(range_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("argument declared \"anyrange\" is not a range type but type %s",
- format_type_be(context_base_type))));
+ errmsg("argument declared %s is not a range type but type %s",
+ "anyrange", format_type_be(context_base_type))));
return range_typelem;
}
else if (context_declared_type == ANYELEMENTOID ||