Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 90b0f30

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. - vacuumdb handles non-translated strings. 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 72329ba commit 90b0f30

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

src/backend/commands/tablecmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9553,7 +9553,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
95539553
ereport(ERROR,
95549554
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
95559555
errmsg("WITH CHECK OPTION is supported only on automatically updatable views"),
9556-
errhint("%s", view_updatable_error)));
9556+
errhint("%s", _(view_updatable_error))));
95579557
}
95589558
}
95599559

src/backend/commands/view.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ DefineView(ViewStmt *stmt, const char *queryString)
496496
ereport(ERROR,
497497
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
498498
errmsg("WITH CHECK OPTION is supported only on automatically updatable views"),
499-
errhint("%s", view_updatable_error)));
499+
errhint("%s", _(view_updatable_error))));
500500
}
501501

502502
/*

src/backend/libpq/auth.c

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

773773

774+
/*
775+
* Generate an error for GSSAPI authentication. The caller should apply
776+
* _() to errmsg to make it translatable.
777+
*/
774778
static void
775779
pg_GSS_error(int severity, char *errmsg, OM_uint32 maj_stat, OM_uint32 min_stat)
776780
{
@@ -960,7 +964,7 @@ pg_GSS_recvauth(Port *port)
960964
{
961965
gss_delete_sec_context(&lmin_s, &port->gss->ctx, GSS_C_NO_BUFFER);
962966
pg_GSS_error(ERROR,
963-
gettext_noop("accepting GSS security context failed"),
967+
_("accepting GSS security context failed"),
964968
maj_stat, min_stat);
965969
}
966970

@@ -986,7 +990,7 @@ pg_GSS_recvauth(Port *port)
986990
maj_stat = gss_display_name(&min_stat, port->gss->name, &gbuf, NULL);
987991
if (maj_stat != GSS_S_COMPLETE)
988992
pg_GSS_error(ERROR,
989-
gettext_noop("retrieving GSS user name failed"),
993+
_("retrieving GSS user name failed"),
990994
maj_stat, min_stat);
991995

992996
/*
@@ -1050,6 +1054,11 @@ pg_GSS_recvauth(Port *port)
10501054
*----------------------------------------------------------------
10511055
*/
10521056
#ifdef ENABLE_SSPI
1057+
1058+
/*
1059+
* Generate an error for SSPI authentication. The caller should apply
1060+
* _() to errmsg to make it translatable.
1061+
*/
10531062
static void
10541063
pg_SSPI_error(int severity, const char *errmsg, SECURITY_STATUS r)
10551064
{

src/backend/rewrite/rewriteHandler.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2154,6 +2154,9 @@ view_has_instead_trigger(Relation view, CmdType event)
21542154
* is auto-updatable. Returns NULL (if the column can be updated) or a message
21552155
* string giving the reason that it cannot be.
21562156
*
2157+
* The returned string has not been translated; if it is shown as an error
2158+
* message, the caller should apply _() to translate it.
2159+
*
21572160
* Note that the checks performed here are local to this view. We do not check
21582161
* whether the referenced column of the underlying base relation is updatable.
21592162
*/
@@ -2193,6 +2196,9 @@ view_col_is_auto_updatable(RangeTblRef *rtr, TargetEntry *tle)
21932196
* view_query_is_auto_updatable - test whether the specified view definition
21942197
* represents an auto-updatable view. Returns NULL (if the view can be updated)
21952198
* or a message string giving the reason that it cannot be.
2199+
2200+
* The returned string has not been translated; if it is shown as an error
2201+
* message, the caller should apply _() to translate it.
21962202
*
21972203
* If check_cols is true, the view is required to have at least one updatable
21982204
* column (necessary for INSERT/UPDATE). Otherwise the view's columns are not
@@ -2332,6 +2338,9 @@ view_query_is_auto_updatable(Query *viewquery, bool check_cols)
23322338
* required columns can be updated) or a message string giving the reason that
23332339
* they cannot be.
23342340
*
2341+
* The returned string has not been translated; if it is shown as an error
2342+
* message, the caller should apply _() to translate it.
2343+
*
23352344
* This should be used for INSERT/UPDATE to ensure that we don't attempt to
23362345
* assign to any non-updatable columns.
23372346
*

src/bin/scripts/vacuumdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ vacuum_one_database(const char *dbname, vacuumingOptions *vacopts,
369369
{
370370
if (stage != ANALYZE_NO_STAGE)
371371
printf(_("%s: processing database \"%s\": %s\n"),
372-
progname, PQdb(conn), stage_messages[stage]);
372+
progname, PQdb(conn), _(stage_messages[stage]));
373373
else
374374
printf(_("%s: vacuuming database \"%s\"\n"),
375375
progname, PQdb(conn));

0 commit comments

Comments
 (0)