summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane2025-12-14 19:30:34 +0000
committerTom Lane2025-12-14 19:30:50 +0000
commitfe7ede45f125af271fb3fef3cc5ee507d4c40d87 (patch)
treeb0aa19c23fb15b4dabdc2a39a864c4a65275005b /src
parent30df61990c67f0cf7450e36c1e038d513960f148 (diff)
Looks like we can't test NLS on machines that lack any es_ES locale.
While commit 5b275a6e1 fixed a few unhappy buildfarm animals, it looks like the remainder simply don't have any es_ES locale at all. There's little point in running the test in that case, so minimize the number of variant expected-files by bailing out. Also emit a log entry so that it's possible to tell from buildfarm postmaster logs which case occurred. Possibly, the scope of this testing could be improved by providing additional translations. But I think it's likely that the failing animals have no non-C locales installed at all. In passing, update typedefs.list so that koel doesn't think regress.c is misformatted. Discussion: https://postgr.es/m/E1vUpNU-000kcQ-1D@gemulon.postgresql.org
Diffstat (limited to 'src')
-rw-r--r--src/test/regress/expected/nls.out10
-rw-r--r--src/test/regress/expected/nls_1.out10
-rw-r--r--src/test/regress/expected/nls_2.out35
-rw-r--r--src/test/regress/sql/nls.sql12
-rw-r--r--src/tools/pgindent/typedefs.list2
5 files changed, 69 insertions, 0 deletions
diff --git a/src/test/regress/expected/nls.out b/src/test/regress/expected/nls.out
index 45c6fc2aaac..2bc795fc822 100644
--- a/src/test/regress/expected/nls.out
+++ b/src/test/regress/expected/nls.out
@@ -9,6 +9,8 @@ CREATE FUNCTION test_translation()
-- 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.
+-- However, if no es_ES locale is installed at all, this'll fail.
+SET lc_messages = 'C';
do $$
declare locale text; ok bool;
begin
@@ -22,7 +24,15 @@ begin
end;
exit when ok;
end loop;
+ -- Don't clutter the expected results with this info, just log it
+ raise log 'NLS regression test: lc_messages = %',
+ current_setting('lc_messages');
end $$;
+SELECT current_setting('lc_messages') = 'C' AS failed \gset
+\if :failed
+\echo Could not find an acceptable spelling of es_ES locale
+\quit
+\endif
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 554d7204bf1..3117fa21ae0 100644
--- a/src/test/regress/expected/nls_1.out
+++ b/src/test/regress/expected/nls_1.out
@@ -9,6 +9,8 @@ CREATE FUNCTION test_translation()
-- 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.
+-- However, if no es_ES locale is installed at all, this'll fail.
+SET lc_messages = 'C';
do $$
declare locale text; ok bool;
begin
@@ -22,7 +24,15 @@ begin
end;
exit when ok;
end loop;
+ -- Don't clutter the expected results with this info, just log it
+ raise log 'NLS regression test: lc_messages = %',
+ current_setting('lc_messages');
end $$;
+SELECT current_setting('lc_messages') = 'C' AS failed \gset
+\if :failed
+\echo Could not find an acceptable spelling of es_ES locale
+\quit
+\endif
SELECT test_translation();
NOTICE: NLS is not enabled
test_translation
diff --git a/src/test/regress/expected/nls_2.out b/src/test/regress/expected/nls_2.out
new file mode 100644
index 00000000000..cb8e4b59d16
--- /dev/null
+++ b/src/test/regress/expected/nls_2.out
@@ -0,0 +1,35 @@
+-- directory paths and dlsuffix are passed to us in environment variables
+\getenv libdir PG_LIBDIR
+\getenv dlsuffix PG_DLSUFFIX
+\set regresslib :libdir '/regress' :dlsuffix
+CREATE FUNCTION test_translation()
+ RETURNS void
+ AS :'regresslib'
+ LANGUAGE C;
+-- 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.
+-- However, if no es_ES locale is installed at all, this'll fail.
+SET lc_messages = 'C';
+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;
+ -- Don't clutter the expected results with this info, just log it
+ raise log 'NLS regression test: lc_messages = %',
+ current_setting('lc_messages');
+end $$;
+SELECT current_setting('lc_messages') = 'C' AS failed \gset
+\if :failed
+\echo Could not find an acceptable spelling of es_ES locale
+Could not find an acceptable spelling of es_ES locale
+\quit
diff --git a/src/test/regress/sql/nls.sql b/src/test/regress/sql/nls.sql
index 9d5b0fd7d45..9c605af2f0b 100644
--- a/src/test/regress/sql/nls.sql
+++ b/src/test/regress/sql/nls.sql
@@ -12,6 +12,9 @@ CREATE FUNCTION test_translation()
-- 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.
+-- However, if no es_ES locale is installed at all, this'll fail.
+SET lc_messages = 'C';
+
do $$
declare locale text; ok bool;
begin
@@ -25,8 +28,17 @@ begin
end;
exit when ok;
end loop;
+ -- Don't clutter the expected results with this info, just log it
+ raise log 'NLS regression test: lc_messages = %',
+ current_setting('lc_messages');
end $$;
+SELECT current_setting('lc_messages') = 'C' AS failed \gset
+\if :failed
+\echo Could not find an acceptable spelling of es_ES locale
+\quit
+\endif
+
SELECT test_translation();
RESET lc_messages;
diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list
index 453bce827ea..efa32dc1295 100644
--- a/src/tools/pgindent/typedefs.list
+++ b/src/tools/pgindent/typedefs.list
@@ -3760,6 +3760,7 @@ int8x16_t
int_fast32_t
int_fast64_t
internalPQconninfoOption
+intmax_t
intptr_t
intset_internal_node
intset_leaf_node
@@ -4214,6 +4215,7 @@ uint8
uint8_t
uint8x16_t
uint_fast64_t
+uintmax_t
uintptr_t
unicodeStyleBorderFormat
unicodeStyleColumnFormat