diff --git a/contrib/hstore_plperl/expected/create_transform.out b/contrib/hstore_plperl/expected/create_transform.out index c588d33ab84982543b3271c0c1b07dfad30e9f67..02dc62af0dad0e0513c448b3f49f75ba63d26b0b 100644 --- a/contrib/hstore_plperl/expected/create_transform.out +++ b/contrib/hstore_plperl/expected/create_transform.out @@ -18,9 +18,9 @@ ERROR: type "foo" does not exist CREATE TRANSFORM FOR hstore LANGUAGE foo (FROM SQL WITH FUNCTION hstore_to_plperl(internal), TO SQL WITH FUNCTION plperl_to_hstore(internal)); -- fail ERROR: language "foo" does not exist CREATE TRANSFORM FOR hstore LANGUAGE plperl (FROM SQL WITH FUNCTION hstore_out(hstore), TO SQL WITH FUNCTION plperl_to_hstore(internal)); -- fail -ERROR: return data type of FROM SQL function must be "internal" +ERROR: return data type of FROM SQL function must be internal CREATE TRANSFORM FOR hstore LANGUAGE plperl (FROM SQL WITH FUNCTION internal_in(cstring), TO SQL WITH FUNCTION plperl_to_hstore(internal)); -- fail -ERROR: first argument of transform function must be type "internal" +ERROR: first argument of transform function must be type internal CREATE TRANSFORM FOR hstore LANGUAGE plperl (FROM SQL WITH FUNCTION hstore_to_plperl(internal), TO SQL WITH FUNCTION plperl_to_hstore(internal)); -- ok CREATE TRANSFORM FOR hstore LANGUAGE plperl (FROM SQL WITH FUNCTION hstore_to_plperl(internal), TO SQL WITH FUNCTION plperl_to_hstore(internal)); -- fail ERROR: transform for type hstore language "plperl" already exists diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c index 7803d0d36845e0d0a4f2feeffc8acb15642cbb9e..640632784c1f5044f6dd384c8631f6fb23423f6c 100644 --- a/src/backend/catalog/aclchk.c +++ b/src/backend/catalog/aclchk.c @@ -1819,7 +1819,8 @@ ExecGrant_Relation(InternalGrant *istmt) */ ereport(ERROR, (errcode(ERRCODE_INVALID_GRANT_OPERATION), - errmsg("invalid privilege type USAGE for table"))); + errmsg("invalid privilege type %s for table", + "USAGE"))); } } } diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c index d82b8baef22eac74ec86d8e36ded1dc6b0447b88..359719e45047ac5ebcffa19aac47ec8fa4d0c7c0 100644 --- a/src/backend/catalog/dependency.c +++ b/src/backend/catalog/dependency.c @@ -1598,7 +1598,8 @@ find_expr_references_walker(Node *node, case REGROLEOID: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("constant of the type \"regrole\" cannot be used here"))); + errmsg("constant of the type %s cannot be used here", + "regrole"))); break; } } diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 72aa0dd6c84b532937942e5019272f11c5550e40..bfc54a8b9f2b5e304796d7050b86ec6b547853df 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -498,7 +498,7 @@ CheckAttributeType(const char *attname, */ ereport(WARNING, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("column \"%s\" has type \"unknown\"", attname), + errmsg("column \"%s\" has type %s", attname, "unknown"), errdetail("Proceeding with relation creation anyway."))); } else if (att_typtype == TYPTYPE_PSEUDO) diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index 015a5fb67dff3ad84f69c9294f95e7164a083d2b..22aecb24f927a629ba0f781a97437d04819a9768 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -1482,11 +1482,13 @@ CreateCast(CreateCastStmt *stmt) if (nargs > 1 && procstruct->proargtypes.values[1] != INT4OID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("second argument of cast function must be type integer"))); + errmsg("second argument of cast function must be type %s", + "integer"))); if (nargs > 2 && procstruct->proargtypes.values[2] != BOOLOID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("third argument of cast function must be type boolean"))); + errmsg("third argument of cast function must be type %s", + "boolean"))); if (!IsBinaryCoercible(procstruct->prorettype, targettypeid)) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), @@ -1776,7 +1778,8 @@ check_transform_function(Form_pg_proc procstruct) if (procstruct->proargtypes.values[0] != INTERNALOID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("first argument of transform function must be type \"internal\""))); + errmsg("first argument of transform function must be type %s", + "internal"))); } @@ -1859,7 +1862,8 @@ CreateTransform(CreateTransformStmt *stmt) if (procstruct->prorettype != INTERNALOID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("return data type of FROM SQL function must be \"internal\""))); + errmsg("return data type of FROM SQL function must be %s", + "internal"))); check_transform_function(procstruct); ReleaseSysCache(tuple); } diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c index c5ce5bdd117d2462e008ecc3c573092418dc5969..b684f413c06465174d17ea8c37213eac757004e3 100644 --- a/src/backend/commands/proclang.c +++ b/src/backend/commands/proclang.c @@ -278,8 +278,9 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) { ereport(WARNING, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("changing return type of function %s from \"opaque\" to \"language_handler\"", - NameListToString(stmt->plhandler)))); + errmsg("changing return type of function %s from %s to %s", + NameListToString(stmt->plhandler), + "opaque", "language_handler"))); SetFunctionReturnType(handlerOid, LANGUAGE_HANDLEROID); } else diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index b404d1ea16ff99ef1198eb208aab28f913fa00cc..3fc3a21cee8cba07fd7faeac430a820c478c4d77 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -522,8 +522,9 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, if (funcrettype == OPAQUEOID) { ereport(WARNING, - (errmsg("changing return type of function %s from \"opaque\" to \"trigger\"", - NameListToString(stmt->funcname)))); + (errmsg("changing return type of function %s from %s to %s", + NameListToString(stmt->funcname), + "opaque", "trigger"))); SetFunctionReturnType(funcoid, TRIGGEROID); } else diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index 29278cf4fa56420d722b7e0580fdc0af143c14e1..2a2ac32157314e62e5e86bbf19e08e6755422c96 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 || diff --git a/src/backend/utils/adt/bool.c b/src/backend/utils/adt/bool.c index 5dfb30cc8e70f24eab18db2b6761845758b7ef3d..6c87e211407d5e506e5b0ebf7083f182a5c6d95d 100644 --- a/src/backend/utils/adt/bool.c +++ b/src/backend/utils/adt/bool.c @@ -150,7 +150,8 @@ boolin(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type boolean: \"%s\"", in_str))); + errmsg("invalid input syntax for type %s: \"%s\"", + "boolean", in_str))); /* not reached */ PG_RETURN_BOOL(false); diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c index a146b0a0bc8461f863ada546f6a1137bdc751c38..ac8f74fee6315dba653d0838010163dbe14eade3 100644 --- a/src/backend/utils/adt/cash.c +++ b/src/backend/utils/adt/cash.c @@ -209,8 +209,8 @@ cash_in(PG_FUNCTION_ARGS) if (newvalue / 10 != value) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("value \"%s\" is out of range for type money", - str))); + errmsg("value \"%s\" is out of range for type %s", + str, "money"))); value = newvalue; @@ -236,8 +236,8 @@ cash_in(PG_FUNCTION_ARGS) if (value > 0) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("value \"%s\" is out of range for type money", - str))); + errmsg("value \"%s\" is out of range for type %s", + str, "money"))); /* adjust for less than required decimal places */ for (; dec < fpoint; dec++) @@ -247,8 +247,8 @@ cash_in(PG_FUNCTION_ARGS) if (newvalue / 10 != value) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("value \"%s\" is out of range for type money", - str))); + errmsg("value \"%s\" is out of range for type %s", + str, "money"))); value = newvalue; } @@ -276,8 +276,8 @@ cash_in(PG_FUNCTION_ARGS) else ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type money: \"%s\"", - str))); + errmsg("invalid input syntax for type %s: \"%s\"", + "money", str))); } /* If the value is supposed to be positive, flip the sign, but check for @@ -288,8 +288,8 @@ cash_in(PG_FUNCTION_ARGS) if (result < 0) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("value \"%s\" is out of range for type money", - str))); + errmsg("value \"%s\" is out of range for type %s", + str, "money"))); } else result = value; diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c index 4d8f1a81a9013736664de51ab1300ac20844b7d3..027f28eb6236e0010ce3c586b0821631a4cc4db4 100644 --- a/src/backend/utils/adt/encode.c +++ b/src/backend/utils/adt/encode.c @@ -439,7 +439,7 @@ esc_decode(const char *src, unsigned srclen, char *dst) */ ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type bytea"))); + errmsg("invalid input syntax for type %s", "bytea"))); } len++; @@ -504,7 +504,7 @@ esc_dec_len(const char *src, unsigned srclen) */ ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type bytea"))); + errmsg("invalid input syntax for type %s", "bytea"))); } len++; diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c index 86b46ded88d500547d13eda88218bc07a6a18343..894f026a41bd204864f0a85b38800a0d7ffcb1b2 100644 --- a/src/backend/utils/adt/float.c +++ b/src/backend/utils/adt/float.c @@ -241,8 +241,8 @@ float4in(PG_FUNCTION_ARGS) if (*num == '\0') ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type real: \"%s\"", - orig_num))); + errmsg("invalid input syntax for type %s: \"%s\"", + "real", orig_num))); errno = 0; val = strtod(num, &endptr); @@ -315,8 +315,8 @@ float4in(PG_FUNCTION_ARGS) else ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type real: \"%s\"", - orig_num))); + errmsg("invalid input syntax for type %s: \"%s\"", + "real", orig_num))); } #ifdef HAVE_BUGGY_SOLARIS_STRTOD else @@ -339,8 +339,8 @@ float4in(PG_FUNCTION_ARGS) if (*endptr != '\0') ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type real: \"%s\"", - orig_num))); + errmsg("invalid input syntax for type %s: \"%s\"", + "real", orig_num))); /* * if we get here, we have a legal double, still need to check to see if diff --git a/src/backend/utils/adt/int8.c b/src/backend/utils/adt/int8.c index b7aa0ad883247134fca92ce3bc8d27e30f5effe2..0c6a412f2aa8ec6b9cf0abd75bf38ff3f94d62be 100644 --- a/src/backend/utils/adt/int8.c +++ b/src/backend/utils/adt/int8.c @@ -95,8 +95,8 @@ scanint8(const char *str, bool errorOK, int64 *result) else ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for integer: \"%s\"", - str))); + errmsg("invalid input syntax for %s: \"%s\"", + "integer", str))); } /* process digits */ @@ -111,8 +111,8 @@ scanint8(const char *str, bool errorOK, int64 *result) else ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("value \"%s\" is out of range for type bigint", - str))); + errmsg("value \"%s\" is out of range for type %s", + str, "bigint"))); } tmp = newtmp; } @@ -130,8 +130,8 @@ gotdigits: else ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for integer: \"%s\"", - str))); + errmsg("invalid input syntax for %s: \"%s\"", + "integer", str))); } *result = (sign < 0) ? -tmp : tmp; diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c index 190ac3651ea245ae116c175aebd37a960edb0f48..628e9de616691dbbe1c04f4607c3ae432aed5c67 100644 --- a/src/backend/utils/adt/json.c +++ b/src/backend/utils/adt/json.c @@ -782,7 +782,7 @@ json_lex_string(JsonLexContext *lex) lex->token_terminator = s; ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Character with value 0x%02x must be escaped.", (unsigned char) *s), report_json_context(lex))); @@ -822,7 +822,8 @@ json_lex_string(JsonLexContext *lex) lex->token_terminator = s + pg_mblen(s); ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", + "json"), errdetail("\"\\u\" must be followed by four hexadecimal digits."), report_json_context(lex))); } @@ -837,7 +838,8 @@ json_lex_string(JsonLexContext *lex) if (hi_surrogate != -1) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", + "json"), errdetail("Unicode high surrogate must not follow a high surrogate."), report_json_context(lex))); hi_surrogate = (ch & 0x3ff) << 10; @@ -848,7 +850,7 @@ json_lex_string(JsonLexContext *lex) if (hi_surrogate == -1) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Unicode low surrogate must follow a high surrogate."), report_json_context(lex))); ch = 0x10000 + hi_surrogate + (ch & 0x3ff); @@ -858,7 +860,7 @@ json_lex_string(JsonLexContext *lex) if (hi_surrogate != -1) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Unicode low surrogate must follow a high surrogate."), report_json_context(lex))); @@ -909,7 +911,8 @@ json_lex_string(JsonLexContext *lex) if (hi_surrogate != -1) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", + "json"), errdetail("Unicode low surrogate must follow a high surrogate."), report_json_context(lex))); @@ -940,7 +943,8 @@ json_lex_string(JsonLexContext *lex) lex->token_terminator = s + pg_mblen(s); ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", + "json"), errdetail("Escape sequence \"\\%s\" is invalid.", extract_mb_char(s)), report_json_context(lex))); @@ -958,7 +962,7 @@ json_lex_string(JsonLexContext *lex) lex->token_terminator = s + pg_mblen(s); ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Escape sequence \"\\%s\" is invalid.", extract_mb_char(s)), report_json_context(lex))); @@ -970,7 +974,7 @@ json_lex_string(JsonLexContext *lex) if (hi_surrogate != -1) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Unicode low surrogate must follow a high surrogate."), report_json_context(lex))); @@ -982,7 +986,7 @@ json_lex_string(JsonLexContext *lex) if (hi_surrogate != -1) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Unicode low surrogate must follow a high surrogate."), report_json_context(lex))); @@ -1127,7 +1131,7 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex) if (lex->token_start == NULL || lex->token_type == JSON_TOKEN_END) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("The input string ended unexpectedly."), report_json_context(lex))); @@ -1141,7 +1145,7 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex) if (ctx == JSON_PARSE_END) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Expected end of input, but found \"%s\".", token), report_json_context(lex))); @@ -1152,7 +1156,7 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex) case JSON_PARSE_VALUE: ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Expected JSON value, but found \"%s\".", token), report_json_context(lex))); @@ -1160,7 +1164,7 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex) case JSON_PARSE_STRING: ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Expected string, but found \"%s\".", token), report_json_context(lex))); @@ -1168,7 +1172,7 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex) case JSON_PARSE_ARRAY_START: ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Expected array element or \"]\", but found \"%s\".", token), report_json_context(lex))); @@ -1176,7 +1180,7 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex) case JSON_PARSE_ARRAY_NEXT: ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Expected \",\" or \"]\", but found \"%s\".", token), report_json_context(lex))); @@ -1184,7 +1188,7 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex) case JSON_PARSE_OBJECT_START: ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Expected string or \"}\", but found \"%s\".", token), report_json_context(lex))); @@ -1192,7 +1196,7 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex) case JSON_PARSE_OBJECT_LABEL: ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Expected \":\", but found \"%s\".", token), report_json_context(lex))); @@ -1200,7 +1204,7 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex) case JSON_PARSE_OBJECT_NEXT: ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Expected \",\" or \"}\", but found \"%s\".", token), report_json_context(lex))); @@ -1208,7 +1212,7 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex) case JSON_PARSE_OBJECT_COMMA: ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Expected string, but found \"%s\".", token), report_json_context(lex))); @@ -1238,7 +1242,7 @@ report_invalid_token(JsonLexContext *lex) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Token \"%s\" is invalid.", token), report_json_context(lex))); } diff --git a/src/backend/utils/adt/mac.c b/src/backend/utils/adt/mac.c index 509315ae0e4c2cd9c4d6b41e5dda38bda6671bfc..2270b223eab9f18f9ff47d5626c9d6a664aa279c 100644 --- a/src/backend/utils/adt/mac.c +++ b/src/backend/utils/adt/mac.c @@ -65,7 +65,8 @@ macaddr_in(PG_FUNCTION_ARGS) if (count != 6) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type macaddr: \"%s\"", str))); + errmsg("invalid input syntax for type %s: \"%s\"", "macaddr", + str))); if ((a < 0) || (a > 255) || (b < 0) || (b > 255) || (c < 0) || (c > 255) || (d < 0) || (d > 255) || diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c index 0364afcc454eecd91f20d7bf74b42a56a201a1dc..c9d0b0d7fbc0d80be19a18632d7d9865dcf77e3e 100644 --- a/src/backend/utils/adt/nabstime.c +++ b/src/backend/utils/adt/nabstime.c @@ -1547,8 +1547,8 @@ parsetinterval(char *i_string, bogus: ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), - errmsg("invalid input syntax for type tinterval: \"%s\"", - i_string))); + errmsg("invalid input syntax for type %s: \"%s\"", + "tinterval", i_string))); *i_start = *i_end = INVALID_ABSTIME; /* keep compiler quiet */ } diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index 5cc8de5af21fb8d48e99274f86313805bdb8f1c2..fa4e1b1e628aef0c3d6c1a212e1f73484630cddf 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -590,8 +590,8 @@ numeric_in(PG_FUNCTION_ARGS) if (!isspace((unsigned char) *cp)) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type numeric: \"%s\"", - str))); + errmsg("invalid input syntax for type %s: \"%s\"", + "numeric", str))); cp++; } } @@ -617,8 +617,8 @@ numeric_in(PG_FUNCTION_ARGS) if (!isspace((unsigned char) *cp)) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type numeric: \"%s\"", - str))); + errmsg("invalid input syntax for type %s: \"%s\"", + "numeric", str))); cp++; } @@ -5482,7 +5482,8 @@ set_var_from_str(const char *str, const char *cp, NumericVar *dest) if (!isdigit((unsigned char) *cp)) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type numeric: \"%s\"", str))); + errmsg("invalid input syntax for type %s: \"%s\"", + "numeric", str))); decdigits = (unsigned char *) palloc(strlen(cp) + DEC_DIGITS * 2); @@ -5505,8 +5506,8 @@ set_var_from_str(const char *str, const char *cp, NumericVar *dest) if (have_dp) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type numeric: \"%s\"", - str))); + errmsg("invalid input syntax for type %s: \"%s\"", + "numeric", str))); have_dp = TRUE; cp++; } @@ -5529,8 +5530,8 @@ set_var_from_str(const char *str, const char *cp, NumericVar *dest) if (endptr == cp) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type numeric: \"%s\"", - str))); + errmsg("invalid input syntax for type %s: \"%s\"", + "numeric", str))); cp = endptr; /* @@ -6331,8 +6332,8 @@ numeric_to_double_no_overflow(Numeric num) /* shouldn't happen ... */ ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type double precision: \"%s\"", - tmp))); + errmsg("invalid input syntax for type %s: \"%s\"", + "double precision", tmp))); } pfree(tmp); @@ -6357,8 +6358,8 @@ numericvar_to_double_no_overflow(NumericVar *var) /* shouldn't happen ... */ ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type double precision: \"%s\"", - tmp))); + errmsg("invalid input syntax for type %s: \"%s\"", + "double precision", tmp))); } pfree(tmp); diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c index 045603f55ccd087f2343dd419d922c0bef067095..4ea2892c98383acbcbf7d47515a4b409189981e3 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 %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 %s: \"%s\"", + "integer", s))); switch (size) { @@ -72,13 +72,15 @@ pg_atoi(const char *s, int size, int c) ) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("value \"%s\" is out of range for type integer", s))); + errmsg("value \"%s\" is out of range for type %s", s, + "integer"))); break; case sizeof(int16): if (errno == ERANGE || l < SHRT_MIN || l > SHRT_MAX) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("value \"%s\" is out of range for type smallint", s))); + errmsg("value \"%s\" is out of range for type %s", s, + "smallint"))); break; case sizeof(int8): if (errno == ERANGE || l < SCHAR_MIN || l > SCHAR_MAX) @@ -100,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 %s: \"%s\"", + "integer", s))); return (int32) l; } diff --git a/src/backend/utils/adt/oid.c b/src/backend/utils/adt/oid.c index b0478f78bd462e82896fdab19aa3e7b3674e9ab2..12ef783b3fcfe8bfc7d8568618f5b9dcfb3253bd 100644 --- a/src/backend/utils/adt/oid.c +++ b/src/backend/utils/adt/oid.c @@ -41,8 +41,8 @@ oidin_subr(const char *s, char **endloc) if (*s == '\0') ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type oid: \"%s\"", - s))); + errmsg("invalid input syntax for type %s: \"%s\"", + "oid", s))); errno = 0; cvt = strtoul(s, &endptr, 10); @@ -55,19 +55,20 @@ oidin_subr(const char *s, char **endloc) if (errno && errno != ERANGE && errno != EINVAL) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type oid: \"%s\"", - s))); + errmsg("invalid input syntax for type %s: \"%s\"", + "oid", s))); if (endptr == s && *s != '\0') ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type oid: \"%s\"", - s))); + errmsg("invalid input syntax for type %s: \"%s\"", + "oid", s))); if (errno == ERANGE) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("value \"%s\" is out of range for type oid", s))); + errmsg("value \"%s\" is out of range for type %s", + s, "oid"))); if (endloc) { @@ -82,8 +83,8 @@ oidin_subr(const char *s, char **endloc) if (*endptr) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type oid: \"%s\"", - s))); + errmsg("invalid input syntax for type %s: \"%s\"", + "oid", s))); } result = (Oid) cvt; @@ -105,7 +106,8 @@ oidin_subr(const char *s, char **endloc) cvt != (unsigned long) ((int) result)) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("value \"%s\" is out of range for type oid", s))); + errmsg("value \"%s\" is out of range for type %s", + s, "oid"))); #endif return result; diff --git a/src/backend/utils/adt/pg_lsn.c b/src/backend/utils/adt/pg_lsn.c index 16c9a0756e45abb54b3b9503e100c8f1804a8dff..aefbb876808a619b726e7eeaf3bc7649f6113ce2 100644 --- a/src/backend/utils/adt/pg_lsn.c +++ b/src/backend/utils/adt/pg_lsn.c @@ -41,12 +41,14 @@ pg_lsn_in(PG_FUNCTION_ARGS) if (len1 < 1 || len1 > MAXPG_LSNCOMPONENT || str[len1] != '/') ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type pg_lsn: \"%s\"", str))); + errmsg("invalid input syntax for type %s: \"%s\"", + "pg_lsn", str))); len2 = strspn(str + len1 + 1, "0123456789abcdefABCDEF"); if (len2 < 1 || len2 > MAXPG_LSNCOMPONENT || str[len1 + 1 + len2] != '\0') ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type pg_lsn: \"%s\"", str))); + errmsg("invalid input syntax for type %s: \"%s\"", + "pg_lsn", str))); /* Decode result. */ id = (uint32) strtoul(str, NULL, 16); diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c index 6eec25e2e506215440a9b79a3dad77cd54584c81..aa7e5e5242fa36766d247621e3ff22f4c6e9f39d 100644 --- a/src/backend/utils/adt/tid.c +++ b/src/backend/utils/adt/tid.c @@ -68,24 +68,24 @@ tidin(PG_FUNCTION_ARGS) if (i < NTIDARGS) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type tid: \"%s\"", - str))); + errmsg("invalid input syntax for type %s: \"%s\"", + "tid", str))); errno = 0; blockNumber = strtoul(coord[0], &badp, 10); if (errno || *badp != DELIM) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type tid: \"%s\"", - str))); + errmsg("invalid input syntax for type %s: \"%s\"", + "tid", str))); hold_offset = strtol(coord[1], &badp, 10); if (errno || *badp != RDELIM || hold_offset > USHRT_MAX || hold_offset < 0) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type tid: \"%s\"", - str))); + errmsg("invalid input syntax for type %s: \"%s\"", + "tid", str))); offsetNumber = hold_offset; diff --git a/src/backend/utils/adt/txid.c b/src/backend/utils/adt/txid.c index 4945c43a8d1a87ea6526d1fd6de5b06a59ec9e2f..772d7c72031a1c47e840835add6befb7475e48a0 100644 --- a/src/backend/utils/adt/txid.c +++ b/src/backend/utils/adt/txid.c @@ -336,8 +336,8 @@ parse_snapshot(const char *str) bad_format: ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type txid_snapshot: \"%s\"", - str_start))); + errmsg("invalid input syntax for type %s: \"%s\"", + "txid_snapshot", str_start))); return NULL; /* keep compiler quiet */ } diff --git a/src/backend/utils/adt/uuid.c b/src/backend/utils/adt/uuid.c index 322116614d0e3de9aa84c19d2066b201cbc43f7e..eaf2f8064d4c75d03612c40183fa87d45d008b10 100644 --- a/src/backend/utils/adt/uuid.c +++ b/src/backend/utils/adt/uuid.c @@ -133,8 +133,8 @@ string_to_uuid(const char *source, pg_uuid_t *uuid) syntax_error: ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for uuid: \"%s\"", - source))); + errmsg("invalid input syntax for type %s: \"%s\"", + "uuid", source))); } Datum diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index fb532fc8d4b42250e8f0c8ad35a00055004d8080..d66e85aa1ef3a087c007004bd76f0132459c139e 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -294,7 +294,7 @@ byteain(PG_FUNCTION_ARGS) */ ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type bytea"))); + errmsg("invalid input syntax for type %s", "bytea"))); } } @@ -335,7 +335,7 @@ byteain(PG_FUNCTION_ARGS) */ ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type bytea"))); + errmsg("invalid input syntax for type %s", "bytea"))); } } diff --git a/src/test/regress/expected/rangefuncs.out b/src/test/regress/expected/rangefuncs.out index f06cfa4b21dc470a3ae1dc86857e4167bc3f736f..275b66204ab69c1dbde95033f1a996a6f470b8be 100644 --- a/src/test/regress/expected/rangefuncs.out +++ b/src/test/regress/expected/rangefuncs.out @@ -1514,7 +1514,7 @@ SELECT dup(22); (1 row) SELECT dup('xyz'); -- fails -ERROR: could not determine polymorphic type because input has type "unknown" +ERROR: could not determine polymorphic type because input has type unknown SELECT dup('xyz'::text); dup ------------------- diff --git a/src/test/regress/expected/uuid.out b/src/test/regress/expected/uuid.out index 59cb1e0ba6f6c6533ed054b499ba2dbe9bf345f8..423f27787f37ba4bbd15ee5591287dfae2df169e 100644 --- a/src/test/regress/expected/uuid.out +++ b/src/test/regress/expected/uuid.out @@ -13,30 +13,30 @@ CREATE TABLE guid2 -- inserting invalid data tests -- too long INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-1111-111111111111F'); -ERROR: invalid input syntax for uuid: "11111111-1111-1111-1111-111111111111F" +ERROR: invalid input syntax for type uuid: "11111111-1111-1111-1111-111111111111F" LINE 1: INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-111... ^ -- too short INSERT INTO guid1(guid_field) VALUES('{11111111-1111-1111-1111-11111111111}'); -ERROR: invalid input syntax for uuid: "{11111111-1111-1111-1111-11111111111}" +ERROR: invalid input syntax for type uuid: "{11111111-1111-1111-1111-11111111111}" LINE 1: INSERT INTO guid1(guid_field) VALUES('{11111111-1111-1111-11... ^ -- valid data but invalid format INSERT INTO guid1(guid_field) VALUES('111-11111-1111-1111-1111-111111111111'); -ERROR: invalid input syntax for uuid: "111-11111-1111-1111-1111-111111111111" +ERROR: invalid input syntax for type uuid: "111-11111-1111-1111-1111-111111111111" LINE 1: INSERT INTO guid1(guid_field) VALUES('111-11111-1111-1111-11... ^ INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-2222-222222222222 '); -ERROR: invalid input syntax for uuid: "{22222222-2222-2222-2222-222222222222 " +ERROR: invalid input syntax for type uuid: "{22222222-2222-2222-2222-222222222222 " LINE 1: INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-22... ^ -- invalid data INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-G111-111111111111'); -ERROR: invalid input syntax for uuid: "11111111-1111-1111-G111-111111111111" +ERROR: invalid input syntax for type uuid: "11111111-1111-1111-G111-111111111111" LINE 1: INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-G11... ^ INSERT INTO guid1(guid_field) VALUES('11+11111-1111-1111-1111-111111111111'); -ERROR: invalid input syntax for uuid: "11+11111-1111-1111-1111-111111111111" +ERROR: invalid input syntax for type uuid: "11+11111-1111-1111-1111-111111111111" LINE 1: INSERT INTO guid1(guid_field) VALUES('11+11111-1111-1111-111... ^ --inserting three input formats