🌐 AI搜索 & 代理 主页
Skip to content

Commit fe7ede4

Browse files
committed
Looks like we can't test NLS on machines that lack any es_ES locale.
While commit 5b275a6 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
1 parent 30df619 commit fe7ede4

File tree

5 files changed

+69
-0
lines changed

5 files changed

+69
-0
lines changed

src/test/regress/expected/nls.out

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ CREATE FUNCTION test_translation()
99
-- There's less standardization in locale name spellings than one could wish.
1010
-- While some platforms insist on having a codeset name in lc_messages,
1111
-- fortunately it seems that it need not match the actual database encoding.
12+
-- However, if no es_ES locale is installed at all, this'll fail.
13+
SET lc_messages = 'C';
1214
do $$
1315
declare locale text; ok bool;
1416
begin
@@ -22,7 +24,15 @@ begin
2224
end;
2325
exit when ok;
2426
end loop;
27+
-- Don't clutter the expected results with this info, just log it
28+
raise log 'NLS regression test: lc_messages = %',
29+
current_setting('lc_messages');
2530
end $$;
31+
SELECT current_setting('lc_messages') = 'C' AS failed \gset
32+
\if :failed
33+
\echo Could not find an acceptable spelling of es_ES locale
34+
\quit
35+
\endif
2636
SELECT test_translation();
2737
NOTICE: traducido PRId64 = 424242424242
2838
NOTICE: traducido PRId32 = -1234

src/test/regress/expected/nls_1.out

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ CREATE FUNCTION test_translation()
99
-- There's less standardization in locale name spellings than one could wish.
1010
-- While some platforms insist on having a codeset name in lc_messages,
1111
-- fortunately it seems that it need not match the actual database encoding.
12+
-- However, if no es_ES locale is installed at all, this'll fail.
13+
SET lc_messages = 'C';
1214
do $$
1315
declare locale text; ok bool;
1416
begin
@@ -22,7 +24,15 @@ begin
2224
end;
2325
exit when ok;
2426
end loop;
27+
-- Don't clutter the expected results with this info, just log it
28+
raise log 'NLS regression test: lc_messages = %',
29+
current_setting('lc_messages');
2530
end $$;
31+
SELECT current_setting('lc_messages') = 'C' AS failed \gset
32+
\if :failed
33+
\echo Could not find an acceptable spelling of es_ES locale
34+
\quit
35+
\endif
2636
SELECT test_translation();
2737
NOTICE: NLS is not enabled
2838
test_translation
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
-- directory paths and dlsuffix are passed to us in environment variables
2+
\getenv libdir PG_LIBDIR
3+
\getenv dlsuffix PG_DLSUFFIX
4+
\set regresslib :libdir '/regress' :dlsuffix
5+
CREATE FUNCTION test_translation()
6+
RETURNS void
7+
AS :'regresslib'
8+
LANGUAGE C;
9+
-- There's less standardization in locale name spellings than one could wish.
10+
-- While some platforms insist on having a codeset name in lc_messages,
11+
-- fortunately it seems that it need not match the actual database encoding.
12+
-- However, if no es_ES locale is installed at all, this'll fail.
13+
SET lc_messages = 'C';
14+
do $$
15+
declare locale text; ok bool;
16+
begin
17+
for locale in values('es_ES'), ('es_ES.UTF-8'), ('es_ES.utf8')
18+
loop
19+
ok = true;
20+
begin
21+
execute format('set lc_messages = %L', locale);
22+
exception when invalid_parameter_value then
23+
ok = false;
24+
end;
25+
exit when ok;
26+
end loop;
27+
-- Don't clutter the expected results with this info, just log it
28+
raise log 'NLS regression test: lc_messages = %',
29+
current_setting('lc_messages');
30+
end $$;
31+
SELECT current_setting('lc_messages') = 'C' AS failed \gset
32+
\if :failed
33+
\echo Could not find an acceptable spelling of es_ES locale
34+
Could not find an acceptable spelling of es_ES locale
35+
\quit

src/test/regress/sql/nls.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ CREATE FUNCTION test_translation()
1212
-- There's less standardization in locale name spellings than one could wish.
1313
-- While some platforms insist on having a codeset name in lc_messages,
1414
-- fortunately it seems that it need not match the actual database encoding.
15+
-- However, if no es_ES locale is installed at all, this'll fail.
16+
SET lc_messages = 'C';
17+
1518
do $$
1619
declare locale text; ok bool;
1720
begin
@@ -25,8 +28,17 @@ begin
2528
end;
2629
exit when ok;
2730
end loop;
31+
-- Don't clutter the expected results with this info, just log it
32+
raise log 'NLS regression test: lc_messages = %',
33+
current_setting('lc_messages');
2834
end $$;
2935

36+
SELECT current_setting('lc_messages') = 'C' AS failed \gset
37+
\if :failed
38+
\echo Could not find an acceptable spelling of es_ES locale
39+
\quit
40+
\endif
41+
3042
SELECT test_translation();
3143

3244
RESET lc_messages;

src/tools/pgindent/typedefs.list

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3760,6 +3760,7 @@ int8x16_t
37603760
int_fast32_t
37613761
int_fast64_t
37623762
internalPQconninfoOption
3763+
intmax_t
37633764
intptr_t
37643765
intset_internal_node
37653766
intset_leaf_node
@@ -4214,6 +4215,7 @@ uint8
42144215
uint8_t
42154216
uint8x16_t
42164217
uint_fast64_t
4218+
uintmax_t
42174219
uintptr_t
42184220
unicodeStyleBorderFormat
42194221
unicodeStyleColumnFormat

0 commit comments

Comments
 (0)