diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2022-09-28 17:14:53 +0200 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2022-09-28 17:14:53 +0200 |
commit | 1dd468c348095010e07eeb844e2e344ad63a52ef (patch) | |
tree | 3007cdd8df2dcf51a7166a7b97b37375a5a90222 | |
parent | 8c17c86154704a89c46c6a9575cf7d792f357c9c (diff) | |
download | postgresql-1dd468c348095010e07eeb844e2e344ad63a52ef.tar.gz |
Change some errdetail() to errdetail_internal()
This prevents marking the argument string for translation for gettext,
and it also prevents the given string (which is already translated) from
being translated at runtime.
Also, mark the strings used as arguments to check_rolespec_name for
translation.
Backpatch all the way back as appropriate. None of this is caught by
any tests (necessarily so), so I verified it manually.
-rw-r--r-- | src/backend/catalog/dependency.c | 6 | ||||
-rw-r--r-- | src/backend/commands/user.c | 4 | ||||
-rw-r--r-- | src/backend/utils/adt/acl.c | 4 | ||||
-rw-r--r-- | src/backend/utils/adt/jsonfuncs.c | 4 | ||||
-rw-r--r-- | src/common/jsonapi.c | 2 |
5 files changed, 10 insertions, 10 deletions
diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c index 89e1628adc..11bc277ba3 100644 --- a/src/backend/catalog/dependency.c +++ b/src/backend/catalog/dependency.c @@ -1199,14 +1199,14 @@ reportDependentObjects(const ObjectAddresses *targetObjects, (errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST), errmsg("cannot drop %s because other objects depend on it", getObjectDescription(origObject)), - errdetail("%s", clientdetail.data), + errdetail_internal("%s", clientdetail.data), errdetail_log("%s", logdetail.data), errhint("Use DROP ... CASCADE to drop the dependent objects too."))); else ereport(ERROR, (errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST), errmsg("cannot drop desired object(s) because other objects depend on them"), - errdetail("%s", clientdetail.data), + errdetail_internal("%s", clientdetail.data), errdetail_log("%s", logdetail.data), errhint("Use DROP ... CASCADE to drop the dependent objects too."))); } @@ -1218,7 +1218,7 @@ reportDependentObjects(const ObjectAddresses *targetObjects, "drop cascades to %d other objects", numReportedClient + numNotReportedClient, numReportedClient + numNotReportedClient), - errdetail("%s", clientdetail.data), + errdetail_internal("%s", clientdetail.data), errdetail_log("%s", logdetail.data))); } else if (numReportedClient == 1) diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index a7d13d7eb9..abfb5eec55 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -567,7 +567,7 @@ AlterRole(AlterRoleStmt *stmt) Oid roleid; check_rolespec_name(stmt->role, - "Cannot alter reserved roles."); + _("Cannot alter reserved roles.")); /* Extract options from the statement node tree */ foreach(option, stmt->options) @@ -922,7 +922,7 @@ AlterRoleSet(AlterRoleSetStmt *stmt) if (stmt->role) { check_rolespec_name(stmt->role, - "Cannot alter reserved roles."); + _("Cannot alter reserved roles.")); roletuple = get_rolespec_tuple(stmt->role); roleform = (Form_pg_authid) GETSTRUCT(roletuple); diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index 05471746fd..c1fc4de857 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -5308,7 +5308,7 @@ get_rolespec_name(const RoleSpec *role) /* * Given a RoleSpec, throw an error if the name is reserved, using detail_msg, - * if provided. + * if provided (which must be already translated). * * If node is NULL, no error is thrown. If detail_msg is NULL then no detail * message is provided. @@ -5329,7 +5329,7 @@ check_rolespec_name(const RoleSpec *role, const char *detail_msg) (errcode(ERRCODE_RESERVED_NAME), errmsg("role name \"%s\" is reserved", role->rolename), - errdetail("%s", detail_msg))); + errdetail_internal("%s", detail_msg))); else ereport(ERROR, (errcode(ERRCODE_RESERVED_NAME), diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index 2651038dd4..69e8dea1a1 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -611,13 +611,13 @@ json_ereport_error(JsonParseErrorType error, JsonLexContext *lex) ereport(ERROR, (errcode(ERRCODE_UNTRANSLATABLE_CHARACTER), errmsg("unsupported Unicode escape sequence"), - errdetail("%s", json_errdetail(error, lex)), + errdetail_internal("%s", json_errdetail(error, lex)), report_json_context(lex))); else ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s", "json"), - errdetail("%s", json_errdetail(error, lex)), + errdetail_internal("%s", json_errdetail(error, lex)), report_json_context(lex))); } diff --git a/src/common/jsonapi.c b/src/common/jsonapi.c index 6fe17a3d37..b296ba7d67 100644 --- a/src/common/jsonapi.c +++ b/src/common/jsonapi.c @@ -1050,7 +1050,7 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex) } /* - * Construct a detail message for a JSON error. + * Construct an (already translated) detail message for a JSON error. */ char * json_errdetail(JsonParseErrorType error, JsonLexContext *lex) |