Skip to content

Commit ecf56dc

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 05aeeb5 commit ecf56dc

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
@@ -10376,7 +10376,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
1037610376
ereport(ERROR,
1037710377
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1037810378
errmsg("WITH CHECK OPTION is supported only on automatically updatable views"),
10379-
errhint("%s", view_updatable_error)));
10379+
errhint("%s", _(view_updatable_error))));
1038010380
}
1038110381
}
1038210382

src/backend/commands/view.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ DefineView(ViewStmt *stmt, const char *queryString,
502502
ereport(ERROR,
503503
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
504504
errmsg("WITH CHECK OPTION is supported only on automatically updatable views"),
505-
errhint("%s", view_updatable_error)));
505+
errhint("%s", _(view_updatable_error))));
506506
}
507507

508508
/*

src/backend/libpq/auth.c

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

10351035

1036+
/*
1037+
* Generate an error for GSSAPI authentication. The caller should apply
1038+
* _() to errmsg to make it translatable.
1039+
*/
10361040
static void
10371041
pg_GSS_error(int severity, char *errmsg, OM_uint32 maj_stat, OM_uint32 min_stat)
10381042
{
@@ -1223,7 +1227,7 @@ pg_GSS_recvauth(Port *port)
12231227
{
12241228
gss_delete_sec_context(&lmin_s, &port->gss->ctx, GSS_C_NO_BUFFER);
12251229
pg_GSS_error(ERROR,
1226-
gettext_noop("accepting GSS security context failed"),
1230+
_("accepting GSS security context failed"),
12271231
maj_stat, min_stat);
12281232
}
12291233

@@ -1249,7 +1253,7 @@ pg_GSS_recvauth(Port *port)
12491253
maj_stat = gss_display_name(&min_stat, port->gss->name, &gbuf, NULL);
12501254
if (maj_stat != GSS_S_COMPLETE)
12511255
pg_GSS_error(ERROR,
1252-
gettext_noop("retrieving GSS user name failed"),
1256+
_("retrieving GSS user name failed"),
12531257
maj_stat, min_stat);
12541258

12551259
/*
@@ -1313,6 +1317,11 @@ pg_GSS_recvauth(Port *port)
13131317
*----------------------------------------------------------------
13141318
*/
13151319
#ifdef ENABLE_SSPI
1320+
1321+
/*
1322+
* Generate an error for SSPI authentication. The caller should apply
1323+
* _() to errmsg to make it translatable.
1324+
*/
13161325
static void
13171326
pg_SSPI_error(int severity, const char *errmsg, SECURITY_STATUS r)
13181327
{

src/backend/rewrite/rewriteHandler.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2212,6 +2212,9 @@ view_has_instead_trigger(Relation view, CmdType event)
22122212
* is auto-updatable. Returns NULL (if the column can be updated) or a message
22132213
* string giving the reason that it cannot be.
22142214
*
2215+
* The returned string has not been translated; if it is shown as an error
2216+
* message, the caller should apply _() to translate it.
2217+
*
22152218
* Note that the checks performed here are local to this view. We do not check
22162219
* whether the referenced column of the underlying base relation is updatable.
22172220
*/
@@ -2251,6 +2254,9 @@ view_col_is_auto_updatable(RangeTblRef *rtr, TargetEntry *tle)
22512254
* view_query_is_auto_updatable - test whether the specified view definition
22522255
* represents an auto-updatable view. Returns NULL (if the view can be updated)
22532256
* or a message string giving the reason that it cannot be.
2257+
2258+
* The returned string has not been translated; if it is shown as an error
2259+
* message, the caller should apply _() to translate it.
22542260
*
22552261
* If check_cols is true, the view is required to have at least one updatable
22562262
* column (necessary for INSERT/UPDATE). Otherwise the view's columns are not
@@ -2391,6 +2397,9 @@ view_query_is_auto_updatable(Query *viewquery, bool check_cols)
23912397
* required columns can be updated) or a message string giving the reason that
23922398
* they cannot be.
23932399
*
2400+
* The returned string has not been translated; if it is shown as an error
2401+
* message, the caller should apply _() to translate it.
2402+
*
23942403
* This should be used for INSERT/UPDATE to ensure that we don't attempt to
23952404
* assign to any non-updatable columns.
23962405
*

src/bin/scripts/vacuumdb.c

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

0 commit comments

Comments
 (0)