Skip to content

Commit f1e7f25

Browse files
committed
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.
1 parent 9923764 commit f1e7f25

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/backend/catalog/dependency.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,14 +1193,14 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
11931193
(errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST),
11941194
errmsg("cannot drop %s because other objects depend on it",
11951195
getObjectDescription(origObject, false)),
1196-
errdetail("%s", clientdetail.data),
1196+
errdetail_internal("%s", clientdetail.data),
11971197
errdetail_log("%s", logdetail.data),
11981198
errhint("Use DROP ... CASCADE to drop the dependent objects too.")));
11991199
else
12001200
ereport(ERROR,
12011201
(errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST),
12021202
errmsg("cannot drop desired object(s) because other objects depend on them"),
1203-
errdetail("%s", clientdetail.data),
1203+
errdetail_internal("%s", clientdetail.data),
12041204
errdetail_log("%s", logdetail.data),
12051205
errhint("Use DROP ... CASCADE to drop the dependent objects too.")));
12061206
}
@@ -1212,7 +1212,7 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
12121212
"drop cascades to %d other objects",
12131213
numReportedClient + numNotReportedClient,
12141214
numReportedClient + numNotReportedClient),
1215-
errdetail("%s", clientdetail.data),
1215+
errdetail_internal("%s", clientdetail.data),
12161216
errdetail_log("%s", logdetail.data)));
12171217
}
12181218
else if (numReportedClient == 1)

src/backend/commands/user.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ AlterRole(AlterRoleStmt *stmt)
567567
Oid roleid;
568568

569569
check_rolespec_name(stmt->role,
570-
"Cannot alter reserved roles.");
570+
_("Cannot alter reserved roles."));
571571

572572
/* Extract options from the statement node tree */
573573
foreach(option, stmt->options)
@@ -922,7 +922,7 @@ AlterRoleSet(AlterRoleSetStmt *stmt)
922922
if (stmt->role)
923923
{
924924
check_rolespec_name(stmt->role,
925-
"Cannot alter reserved roles.");
925+
_("Cannot alter reserved roles."));
926926

927927
roletuple = get_rolespec_tuple(stmt->role);
928928
roleform = (Form_pg_authid) GETSTRUCT(roletuple);

src/backend/utils/adt/acl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5226,7 +5226,7 @@ get_rolespec_name(const RoleSpec *role)
52265226

52275227
/*
52285228
* Given a RoleSpec, throw an error if the name is reserved, using detail_msg,
5229-
* if provided.
5229+
* if provided (which must be already translated).
52305230
*
52315231
* If node is NULL, no error is thrown. If detail_msg is NULL then no detail
52325232
* message is provided.
@@ -5247,7 +5247,7 @@ check_rolespec_name(const RoleSpec *role, const char *detail_msg)
52475247
(errcode(ERRCODE_RESERVED_NAME),
52485248
errmsg("role name \"%s\" is reserved",
52495249
role->rolename),
5250-
errdetail("%s", detail_msg)));
5250+
errdetail_internal("%s", detail_msg)));
52515251
else
52525252
ereport(ERROR,
52535253
(errcode(ERRCODE_RESERVED_NAME),

src/backend/utils/adt/jsonfuncs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,13 +615,13 @@ json_ereport_error(JsonParseErrorType error, JsonLexContext *lex)
615615
ereport(ERROR,
616616
(errcode(ERRCODE_UNTRANSLATABLE_CHARACTER),
617617
errmsg("unsupported Unicode escape sequence"),
618-
errdetail("%s", json_errdetail(error, lex)),
618+
errdetail_internal("%s", json_errdetail(error, lex)),
619619
report_json_context(lex)));
620620
else
621621
ereport(ERROR,
622622
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
623623
errmsg("invalid input syntax for type %s", "json"),
624-
errdetail("%s", json_errdetail(error, lex)),
624+
errdetail_internal("%s", json_errdetail(error, lex)),
625625
report_json_context(lex)));
626626
}
627627

src/common/jsonapi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex)
10521052
}
10531053

10541054
/*
1055-
* Construct a detail message for a JSON error.
1055+
* Construct an (already translated) detail message for a JSON error.
10561056
*/
10571057
char *
10581058
json_errdetail(JsonParseErrorType error, JsonLexContext *lex)

0 commit comments

Comments
 (0)