Skip to content

Commit 788ae09

Browse files
committed
Fix set of NLS translation issues
While monitoring the code, a couple of issues related to string translation has showed up: - Some routines for auto-updatable views return an error string, which sometimes missed the shot. A comment regarding string translation is added for each routine to help with future features. - GSSAPI authentication missed two translations. Reported-by: Kyotaro Horiguchi Author: Kyotaro Horiguchi Reviewed-by: Michael Paquier, Tom Lane Discussion: https://postgr.es/m/20180810.152131.31921918.horiguchi.kyotaro@lab.ntt.co.jp Backpatch-through: 9.3
1 parent a4fdcce commit 788ae09

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

src/backend/commands/tablecmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9041,7 +9041,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
90419041
ereport(ERROR,
90429042
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
90439043
errmsg("WITH CHECK OPTION is supported only on automatically updatable views"),
9044-
errhint("%s", view_updatable_error)));
9044+
errhint("%s", _(view_updatable_error))));
90459045
}
90469046
}
90479047

src/backend/commands/view.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ DefineView(ViewStmt *stmt, const char *queryString)
489489
ereport(ERROR,
490490
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
491491
errmsg("WITH CHECK OPTION is supported only on automatically updatable views"),
492-
errhint("%s", view_updatable_error)));
492+
errhint("%s", _(view_updatable_error))));
493493
}
494494

495495
/*

src/backend/libpq/auth.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,10 @@ static GSS_DLLIMP gss_OID GSS_C_NT_USER_NAME = &GSS_C_NT_USER_NAME_desc;
751751
#endif
752752

753753

754+
/*
755+
* Generate an error for GSSAPI authentication. The caller should apply
756+
* _() to errmsg to make it translatable.
757+
*/
754758
static void
755759
pg_GSS_error(int severity, char *errmsg, OM_uint32 maj_stat, OM_uint32 min_stat)
756760
{
@@ -935,7 +939,7 @@ pg_GSS_recvauth(Port *port)
935939
{
936940
gss_delete_sec_context(&lmin_s, &port->gss->ctx, GSS_C_NO_BUFFER);
937941
pg_GSS_error(ERROR,
938-
gettext_noop("accepting GSS security context failed"),
942+
_("accepting GSS security context failed"),
939943
maj_stat, min_stat);
940944
}
941945

@@ -961,7 +965,7 @@ pg_GSS_recvauth(Port *port)
961965
maj_stat = gss_display_name(&min_stat, port->gss->name, &gbuf, NULL);
962966
if (maj_stat != GSS_S_COMPLETE)
963967
pg_GSS_error(ERROR,
964-
gettext_noop("retrieving GSS user name failed"),
968+
_("retrieving GSS user name failed"),
965969
maj_stat, min_stat);
966970

967971
/*
@@ -1025,6 +1029,11 @@ pg_GSS_recvauth(Port *port)
10251029
*----------------------------------------------------------------
10261030
*/
10271031
#ifdef ENABLE_SSPI
1032+
1033+
/*
1034+
* Generate an error for SSPI authentication. The caller should apply
1035+
* _() to errmsg to make it translatable.
1036+
*/
10281037
static void
10291038
pg_SSPI_error(int severity, const char *errmsg, SECURITY_STATUS r)
10301039
{

src/backend/rewrite/rewriteHandler.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,6 +2008,9 @@ view_has_instead_trigger(Relation view, CmdType event)
20082008
* is auto-updatable. Returns NULL (if the column can be updated) or a message
20092009
* string giving the reason that it cannot be.
20102010
*
2011+
* The returned string has not been translated; if it is shown as an error
2012+
* message, the caller should apply _() to translate it.
2013+
*
20112014
* Note that the checks performed here are local to this view. We do not check
20122015
* whether the referenced column of the underlying base relation is updatable.
20132016
*/
@@ -2047,6 +2050,9 @@ view_col_is_auto_updatable(RangeTblRef *rtr, TargetEntry *tle)
20472050
* view_query_is_auto_updatable - test whether the specified view definition
20482051
* represents an auto-updatable view. Returns NULL (if the view can be updated)
20492052
* or a message string giving the reason that it cannot be.
2053+
2054+
* The returned string has not been translated; if it is shown as an error
2055+
* message, the caller should apply _() to translate it.
20502056
*
20512057
* If check_cols is true, the view is required to have at least one updatable
20522058
* column (necessary for INSERT/UPDATE). Otherwise the view's columns are not
@@ -2183,6 +2189,9 @@ view_query_is_auto_updatable(Query *viewquery, bool check_cols)
21832189
* required columns can be updated) or a message string giving the reason that
21842190
* they cannot be.
21852191
*
2192+
* The returned string has not been translated; if it is shown as an error
2193+
* message, the caller should apply _() to translate it.
2194+
*
21862195
* This should be used for INSERT/UPDATE to ensure that we don't attempt to
21872196
* assign to any non-updatable columns.
21882197
*

0 commit comments

Comments
 (0)