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.
This commit is contained in:
Alvaro Herrera 2022-09-28 17:14:53 +02:00
parent 5d6c5d0e95
commit c0c2a9b01a
No known key found for this signature in database
GPG Key ID: 1C20ACB9D5C564AE
3 changed files with 7 additions and 7 deletions

View File

@ -991,14 +991,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.")));
}
@ -1010,7 +1010,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)

View File

@ -552,7 +552,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)
@ -906,7 +906,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);
roleid = HeapTupleGetOid(roletuple);

View File

@ -5307,7 +5307,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.
@ -5328,7 +5328,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),