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

Commit 84a3778

Browse files
committed
Revert "Avoid requiring Spanish locale to test NLS infrastructure."
This reverts commit 7db6809. That doesn't seem to work with recent (last couple of years) glibc, and the reasons are obscure. I can't let the farm stay this broken for long.
1 parent f7fbd02 commit 84a3778

File tree

8 files changed

+314
-237
lines changed

8 files changed

+314
-237
lines changed

src/test/regress/expected/nls.out

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,50 @@ CREATE FUNCTION test_translation()
66
RETURNS void
77
AS :'regresslib'
88
LANGUAGE C;
9-
-- We don't want to assume that the platform has any particular language
10-
-- installed, so we use a "translation" for the C locale. However, gettext
11-
-- will short-circuit translation if lc_messages is just 'C'. Fake it out
12-
-- by appending a codeset name. Fortunately it seems that that need not
13-
-- match the actual database encoding.
14-
SET lc_messages = 'C.UTF-8';
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+
\quit
35+
\endif
1536
SELECT test_translation();
16-
NOTICE: translated PRId64 = 424242424242
17-
NOTICE: translated PRId32 = -1234
18-
NOTICE: translated PRIdMAX = -123456789012
19-
NOTICE: translated PRIdPTR = -9999
20-
NOTICE: translated PRIu64 = 424242424242
21-
NOTICE: translated PRIu32 = 4294966062
22-
NOTICE: translated PRIuMAX = 123456789012
23-
NOTICE: translated PRIuPTR = 9999
24-
NOTICE: translated PRIx64 = 62c6d1a9b2
25-
NOTICE: translated PRIx32 = fffffb2e
26-
NOTICE: translated PRIxMAX = 1cbe991a14
27-
NOTICE: translated PRIxPTR = 270f
28-
NOTICE: translated PRIX64 = 62C6D1A9B2
29-
NOTICE: translated PRIX32 = FFFFFB2E
30-
NOTICE: translated PRIXMAX = 1CBE991A14
31-
NOTICE: translated PRIXPTR = 270F
37+
NOTICE: traducido PRId64 = 424242424242
38+
NOTICE: traducido PRId32 = -1234
39+
NOTICE: traducido PRIdMAX = -5678
40+
NOTICE: traducido PRIdPTR = 9999
41+
NOTICE: traducido PRIu64 = 424242424242
42+
NOTICE: traducido PRIu32 = 1234
43+
NOTICE: traducido PRIuMAX = 5678
44+
NOTICE: traducido PRIuPTR = 9999
45+
NOTICE: traducido PRIx64 = 62c6d1a9b2
46+
NOTICE: traducido PRIx32 = 4d2
47+
NOTICE: traducido PRIxMAX = 162e
48+
NOTICE: traducido PRIxPTR = 270f
49+
NOTICE: traducido PRIX64 = 62C6D1A9B2
50+
NOTICE: traducido PRIX32 = 4D2
51+
NOTICE: traducido PRIXMAX = 162E
52+
NOTICE: traducido PRIXPTR = 270F
3253
test_translation
3354
------------------
3455

src/test/regress/expected/nls_1.out

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,35 @@ CREATE FUNCTION test_translation()
66
RETURNS void
77
AS :'regresslib'
88
LANGUAGE C;
9-
-- We don't want to assume that the platform has any particular language
10-
-- installed, so we use a "translation" for the C locale. However, gettext
11-
-- will short-circuit translation if lc_messages is just 'C'. Fake it out
12-
-- by appending a codeset name. Fortunately it seems that that need not
13-
-- match the actual database encoding.
14-
SET lc_messages = 'C.UTF-8';
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+
\quit
35+
\endif
1536
SELECT test_translation();
1637
NOTICE: NLS is not enabled
17-
NOTICE: untranslated PRId64 = 424242424242
18-
NOTICE: untranslated PRId32 = -1234
19-
NOTICE: untranslated PRIdMAX = -123456789012
20-
NOTICE: untranslated PRIdPTR = -9999
21-
NOTICE: untranslated PRIu64 = 424242424242
22-
NOTICE: untranslated PRIu32 = 4294966062
23-
NOTICE: untranslated PRIuMAX = 123456789012
24-
NOTICE: untranslated PRIuPTR = 9999
25-
NOTICE: untranslated PRIx64 = 62c6d1a9b2
26-
NOTICE: untranslated PRIx32 = fffffb2e
27-
NOTICE: untranslated PRIxMAX = 1cbe991a14
28-
NOTICE: untranslated PRIxPTR = 270f
29-
NOTICE: untranslated PRIX64 = 62C6D1A9B2
30-
NOTICE: untranslated PRIX32 = FFFFFB2E
31-
NOTICE: untranslated PRIXMAX = 1CBE991A14
32-
NOTICE: untranslated PRIXPTR = 270F
3338
test_translation
3439
------------------
3540

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/po/C.po

Lines changed: 0 additions & 161 deletions
This file was deleted.

src/test/regress/po/LINGUAS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
C
1+
es

0 commit comments

Comments
 (0)