postgres.git / summary / log / commit / refs
commit 788ae09f4a9560c344a0c8457ffb66bba42be0a7
Author: Michael Paquier <michael@paquier.xyz>
Date: Tue Aug 21 06:18:24 2018 +0000
First released in: 12.0, 9.3.25, 9.4.20, 9.5.15, 9.6.11, 10.6, 11.0
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
src/backend/commands/tablecmds.c | 2 +-
src/backend/commands/view.c | 2 +-
src/backend/libpq/auth.c | 13 +++++++++++--
src/backend/rewrite/rewriteHandler.c | 9 +++++++++
4 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 567c09a5c32..f2b6a3fb6aa 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -9041,7 +9041,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("WITH CHECK OPTION is supported only on automatically updatable views"),
- errhint("%s", view_updatable_error)));
+ errhint("%s", _(view_updatable_error))));
}
}
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index 730f2d47560..c1e1c665a7e 100644
--- a/src/backend/commands/view.c
+++ b/src/backend/commands/view.c
@@ -489,7 +489,7 @@ DefineView(ViewStmt *stmt, const char *queryString)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("WITH CHECK OPTION is supported only on automatically updatable views"),
- errhint("%s", view_updatable_error)));
+ errhint("%s", _(view_updatable_error))));
}
/*
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index ce0d45ae739..eb695a901d3 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -751,6 +751,10 @@ static GSS_DLLIMP gss_OID GSS_C_NT_USER_NAME = &GSS_C_NT_USER_NAME_desc;
#endif
+/*
+ * Generate an error for GSSAPI authentication. The caller should apply
+ * _() to errmsg to make it translatable.
+ */
static void
pg_GSS_error(int severity, char *errmsg, OM_uint32 maj_stat, OM_uint32 min_stat)
{
@@ -935,7 +939,7 @@ pg_GSS_recvauth(Port *port)
{
gss_delete_sec_context(&lmin_s, &port->gss->ctx, GSS_C_NO_BUFFER);
pg_GSS_error(ERROR,
- gettext_noop("accepting GSS security context failed"),
+ _("accepting GSS security context failed"),
maj_stat, min_stat);
}
@@ -961,7 +965,7 @@ pg_GSS_recvauth(Port *port)
maj_stat = gss_display_name(&min_stat, port->gss->name, &gbuf, NULL);
if (maj_stat != GSS_S_COMPLETE)
pg_GSS_error(ERROR,
- gettext_noop("retrieving GSS user name failed"),
+ _("retrieving GSS user name failed"),
maj_stat, min_stat);
/*
@@ -1025,6 +1029,11 @@ pg_GSS_recvauth(Port *port)
*----------------------------------------------------------------
*/
#ifdef ENABLE_SSPI
+
+/*
+ * Generate an error for SSPI authentication. The caller should apply
+ * _() to errmsg to make it translatable.
+ */
static void
pg_SSPI_error(int severity, const char *errmsg, SECURITY_STATUS r)
{
diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c
index c4692b35e15..4a99f5c2d5a 100644
--- a/src/backend/rewrite/rewriteHandler.c
+++ b/src/backend/rewrite/rewriteHandler.c
@@ -2008,6 +2008,9 @@ view_has_instead_trigger(Relation view, CmdType event)
* is auto-updatable. Returns NULL (if the column can be updated) or a message
* string giving the reason that it cannot be.
*
+ * The returned string has not been translated; if it is shown as an error
+ * message, the caller should apply _() to translate it.
+ *
* Note that the checks performed here are local to this view. We do not check
* whether the referenced column of the underlying base relation is updatable.
*/
@@ -2047,6 +2050,9 @@ view_col_is_auto_updatable(RangeTblRef *rtr, TargetEntry *tle)
* view_query_is_auto_updatable - test whether the specified view definition
* represents an auto-updatable view. Returns NULL (if the view can be updated)
* or a message string giving the reason that it cannot be.
+
+ * The returned string has not been translated; if it is shown as an error
+ * message, the caller should apply _() to translate it.
*
* If check_cols is true, the view is required to have at least one updatable
* 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)
* required columns can be updated) or a message string giving the reason that
* they cannot be.
*
+ * The returned string has not been translated; if it is shown as an error
+ * message, the caller should apply _() to translate it.
+ *
* This should be used for INSERT/UPDATE to ensure that we don't attempt to
* assign to any non-updatable columns.
*
[parent: a4fdcceaba1f]