Looks like we can't test NLS on machines that lack any es_ES locale. master github/master
authorTom Lane <[email protected]>
Sun, 14 Dec 2025 19:30:34 +0000 (14:30 -0500)
committerTom Lane <[email protected]>
Sun, 14 Dec 2025 19:30:50 +0000 (14:30 -0500)
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/[email protected]

src/test/regress/expected/nls.out
src/test/regress/expected/nls_1.out
src/test/regress/expected/nls_2.out [new file with mode: 0644]
src/test/regress/sql/nls.sql
src/tools/pgindent/typedefs.list

index 45c6fc2aaac7a97ab2d647d174f538b130f33c12..2bc795fc822049b9ec1ace15f53cf805479bbffb 100644 (file)
@@ -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
index 554d7204bf17ea03a5e2fa316bfe3761c0daea39..3117fa21ae02d77632242e2d8af1262ce11b8037 100644 (file)
@@ -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 (file)
index 0000000..cb8e4b5
--- /dev/null
@@ -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
index 9d5b0fd7d4514e9e984ce94fdeab28167e075a2d..9c605af2f0ba58039765d0da2cc958bf2be0215d 100644 (file)
@@ -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;
index 453bce827ea61c4f5dd2456b33207d368cf0961a..efa32dc1295f394b54800e744d4ad4dc00333bf8 100644 (file)
@@ -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