From ec6e70c79fffe9292402ee602d3742a8c7d31bd2 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 12 May 2021 07:20:10 +0200 Subject: [PATCH] Refactor some error messages for easier translation --- src/backend/access/common/toast_compression.c | 2 +- src/backend/parser/parse_coerce.c | 12 ++++++------ src/backend/utils/adt/pg_locale.c | 2 +- src/backend/utils/adt/xml.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/backend/access/common/toast_compression.c b/src/backend/access/common/toast_compression.c index 52dedac263..682fd70e2e 100644 --- a/src/backend/access/common/toast_compression.c +++ b/src/backend/access/common/toast_compression.c @@ -31,7 +31,7 @@ int default_toast_compression = TOAST_PGLZ_COMPRESSION; (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), \ errmsg("unsupported LZ4 compression method"), \ errdetail("This functionality requires the server to be built with lz4 support."), \ - errhint("You need to rebuild PostgreSQL using --with-lz4."))) + errhint("You need to rebuild PostgreSQL using %s.", "--with-lz4"))) /* * Compress a varlena using PGLZ. diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index aa4a21126d..7e963b8895 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -2086,7 +2086,7 @@ enforce_generic_type_consistency(const Oid *actual_arg_types, if (OidIsValid(elem_typeid) && actual_type != elem_typeid) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("arguments declared \"anyelement\" are not all alike"), + errmsg("arguments declared \"%s\" are not all alike", "anyelement"), errdetail("%s versus %s", format_type_be(elem_typeid), format_type_be(actual_type)))); @@ -2106,7 +2106,7 @@ enforce_generic_type_consistency(const Oid *actual_arg_types, if (OidIsValid(array_typeid) && actual_type != array_typeid) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("arguments declared \"anyarray\" are not all alike"), + errmsg("arguments declared \"%s\" are not all alike", "anyarray"), errdetail("%s versus %s", format_type_be(array_typeid), format_type_be(actual_type)))); @@ -2126,7 +2126,7 @@ enforce_generic_type_consistency(const Oid *actual_arg_types, if (OidIsValid(range_typeid) && actual_type != range_typeid) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("arguments declared \"anyrange\" are not all alike"), + errmsg("arguments declared \"%s\" are not all alike", "anyrange"), errdetail("%s versus %s", format_type_be(range_typeid), format_type_be(actual_type)))); @@ -2146,7 +2146,7 @@ enforce_generic_type_consistency(const Oid *actual_arg_types, if (OidIsValid(multirange_typeid) && actual_type != multirange_typeid) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("arguments declared \"anymultirange\" are not all alike"), + errmsg("arguments declared \"%s\" are not all alike", "anymultirange"), errdetail("%s versus %s", format_type_be(multirange_typeid), format_type_be(actual_type)))); @@ -2201,7 +2201,7 @@ enforce_generic_type_consistency(const Oid *actual_arg_types, if (anycompatible_range_typeid != actual_type) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("arguments declared \"anycompatiblerange\" are not all alike"), + errmsg("arguments declared \"%s\" are not all alike", "anycompatiblerange"), errdetail("%s versus %s", format_type_be(anycompatible_range_typeid), format_type_be(actual_type)))); @@ -2234,7 +2234,7 @@ enforce_generic_type_consistency(const Oid *actual_arg_types, if (anycompatible_multirange_typeid != actual_type) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("arguments declared \"anycompatiblemultirange\" are not all alike"), + errmsg("arguments declared \"%s\" are not all alike", "anycompatiblemultirange"), errdetail("%s versus %s", format_type_be(anycompatible_multirange_typeid), format_type_be(actual_type)))); diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c index eab089f252..caa09d6373 100644 --- a/src/backend/utils/adt/pg_locale.c +++ b/src/backend/utils/adt/pg_locale.c @@ -1586,7 +1586,7 @@ pg_newlocale_from_collation(Oid collid) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("ICU is not supported in this build"), \ - errhint("You need to rebuild PostgreSQL using --with-icu."))); + errhint("You need to rebuild PostgreSQL using %s.", "--with-icu"))); #endif /* not USE_ICU */ } diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index 7350940b66..3ae5cfac9e 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -221,7 +221,7 @@ const TableFuncRoutine XmlTableRoutine = (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), \ errmsg("unsupported XML feature"), \ errdetail("This functionality requires the server to be built with libxml support."), \ - errhint("You need to rebuild PostgreSQL using --with-libxml."))) + errhint("You need to rebuild PostgreSQL using %s.", "--with-libxml"))) /* from SQL/XML:2008 section 4.9 */