summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2025-12-14 17:54:57 +0000
committerTom Lane2025-12-14 17:54:57 +0000
commit5b275a6e154833803d3beb49da0879d2fe8b1d6c (patch)
tree49b2bf13bffb04f478e126d64d2c2358962bf4d8
parentb853e644d78d99ef1779c9bf7bc3944694460aa2 (diff)
Try a few different locale name spellings in nls.sql.
While CI testing in advance of commit 8c498479d suggested that all Unix-ish platforms would accept 'es_ES.UTF-8', the buildfarm has a different opinion. Let's dynamically select something that works, if possible. Discussion: https://postgr.es/m/E1vUpNU-000kcQ-1D@gemulon.postgresql.org
-rw-r--r--src/test/regress/expected/nls.out21
-rw-r--r--src/test/regress/expected/nls_1.out21
-rw-r--r--src/test/regress/sql/nls.sql21
3 files changed, 51 insertions, 12 deletions
diff --git a/src/test/regress/expected/nls.out b/src/test/regress/expected/nls.out
index 5a650294eaf..45c6fc2aaac 100644
--- a/src/test/regress/expected/nls.out
+++ b/src/test/regress/expected/nls.out
@@ -6,10 +6,23 @@ CREATE FUNCTION test_translation()
RETURNS void
AS :'regresslib'
LANGUAGE C;
--- Some BSDen are sticky about wanting a codeset name in lc_messages,
--- but it seems that at least on common platforms it doesn't have
--- to match the actual database encoding.
-SET lc_messages = 'es_ES.UTF-8';
+-- There's less standardization in locale name spellings than one could wish.
+-- While some platforms insist on having a codeset name in lc_messages,
+-- fortunately it seems that it need not match the actual database encoding.
+do $$
+declare locale text; ok bool;
+begin
+ for locale in values('es_ES'), ('es_ES.UTF-8'), ('es_ES.utf8')
+ loop
+ ok = true;
+ begin
+ execute format('set lc_messages = %L', locale);
+ exception when invalid_parameter_value then
+ ok = false;
+ end;
+ exit when ok;
+ end loop;
+end $$;
SELECT test_translation();
NOTICE: traducido PRId64 = 424242424242
NOTICE: traducido PRId32 = -1234
diff --git a/src/test/regress/expected/nls_1.out b/src/test/regress/expected/nls_1.out
index 9f1a2776e50..554d7204bf1 100644
--- a/src/test/regress/expected/nls_1.out
+++ b/src/test/regress/expected/nls_1.out
@@ -6,10 +6,23 @@ CREATE FUNCTION test_translation()
RETURNS void
AS :'regresslib'
LANGUAGE C;
--- Some BSDen are sticky about wanting a codeset name in lc_messages,
--- but it seems that at least on common platforms it doesn't have
--- to match the actual database encoding.
-SET lc_messages = 'es_ES.UTF-8';
+-- There's less standardization in locale name spellings than one could wish.
+-- While some platforms insist on having a codeset name in lc_messages,
+-- fortunately it seems that it need not match the actual database encoding.
+do $$
+declare locale text; ok bool;
+begin
+ for locale in values('es_ES'), ('es_ES.UTF-8'), ('es_ES.utf8')
+ loop
+ ok = true;
+ begin
+ execute format('set lc_messages = %L', locale);
+ exception when invalid_parameter_value then
+ ok = false;
+ end;
+ exit when ok;
+ end loop;
+end $$;
SELECT test_translation();
NOTICE: NLS is not enabled
test_translation
diff --git a/src/test/regress/sql/nls.sql b/src/test/regress/sql/nls.sql
index efeda8c5841..9d5b0fd7d45 100644
--- a/src/test/regress/sql/nls.sql
+++ b/src/test/regress/sql/nls.sql
@@ -9,10 +9,23 @@ CREATE FUNCTION test_translation()
AS :'regresslib'
LANGUAGE C;
--- Some BSDen are sticky about wanting a codeset name in lc_messages,
--- but it seems that at least on common platforms it doesn't have
--- to match the actual database encoding.
-SET lc_messages = 'es_ES.UTF-8';
+-- There's less standardization in locale name spellings than one could wish.
+-- While some platforms insist on having a codeset name in lc_messages,
+-- fortunately it seems that it need not match the actual database encoding.
+do $$
+declare locale text; ok bool;
+begin
+ for locale in values('es_ES'), ('es_ES.UTF-8'), ('es_ES.utf8')
+ loop
+ ok = true;
+ begin
+ execute format('set lc_messages = %L', locale);
+ exception when invalid_parameter_value then
+ ok = false;
+ end;
+ exit when ok;
+ end loop;
+end $$;
SELECT test_translation();