1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-19 17:02:53 +03:00

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
This commit is contained in:
Tom Lane
2025-12-14 14:30:34 -05:00
parent 30df61990c
commit fe7ede45f1
5 changed files with 69 additions and 0 deletions

View File

@@ -9,6 +9,8 @@ CREATE FUNCTION test_translation()
-- There's less standardization in locale name spellings than one could wish. -- There's less standardization in locale name spellings than one could wish.
-- While some platforms insist on having a codeset name in lc_messages, -- While some platforms insist on having a codeset name in lc_messages,
-- fortunately it seems that it need not match the actual database encoding. -- 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 $$ do $$
declare locale text; ok bool; declare locale text; ok bool;
begin begin
@@ -22,7 +24,15 @@ begin
end; end;
exit when ok; exit when ok;
end loop; 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 $$; 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(); SELECT test_translation();
NOTICE: traducido PRId64 = 424242424242 NOTICE: traducido PRId64 = 424242424242
NOTICE: traducido PRId32 = -1234 NOTICE: traducido PRId32 = -1234

View File

@@ -9,6 +9,8 @@ CREATE FUNCTION test_translation()
-- There's less standardization in locale name spellings than one could wish. -- There's less standardization in locale name spellings than one could wish.
-- While some platforms insist on having a codeset name in lc_messages, -- While some platforms insist on having a codeset name in lc_messages,
-- fortunately it seems that it need not match the actual database encoding. -- 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 $$ do $$
declare locale text; ok bool; declare locale text; ok bool;
begin begin
@@ -22,7 +24,15 @@ begin
end; end;
exit when ok; exit when ok;
end loop; 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 $$; 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(); SELECT test_translation();
NOTICE: NLS is not enabled NOTICE: NLS is not enabled
test_translation test_translation

View File

@@ -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

View File

@@ -12,6 +12,9 @@ CREATE FUNCTION test_translation()
-- There's less standardization in locale name spellings than one could wish. -- There's less standardization in locale name spellings than one could wish.
-- While some platforms insist on having a codeset name in lc_messages, -- While some platforms insist on having a codeset name in lc_messages,
-- fortunately it seems that it need not match the actual database encoding. -- 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 $$ do $$
declare locale text; ok bool; declare locale text; ok bool;
begin begin
@@ -25,8 +28,17 @@ begin
end; end;
exit when ok; exit when ok;
end loop; 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 $$; 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(); SELECT test_translation();
RESET lc_messages; RESET lc_messages;

View File

@@ -3760,6 +3760,7 @@ int8x16_t
int_fast32_t int_fast32_t
int_fast64_t int_fast64_t
internalPQconninfoOption internalPQconninfoOption
intmax_t
intptr_t intptr_t
intset_internal_node intset_internal_node
intset_leaf_node intset_leaf_node
@@ -4214,6 +4215,7 @@ uint8
uint8_t uint8_t
uint8x16_t uint8x16_t
uint_fast64_t uint_fast64_t
uintmax_t
uintptr_t uintptr_t
unicodeStyleBorderFormat unicodeStyleBorderFormat
unicodeStyleColumnFormat unicodeStyleColumnFormat