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

Commit 5b275a6

Browse files
committed
Try a few different locale name spellings in nls.sql.
While CI testing in advance of commit 8c49847 suggested that all Unix-ish platforms would accept 'es_ES.UTF-8', the buildfarm has a different opinion. Let's dynamically select something that works, if possible. Discussion: https://postgr.es/m/E1vUpNU-000kcQ-1D@gemulon.postgresql.org
1 parent b853e64 commit 5b275a6

File tree

3 files changed

+51
-12
lines changed

3 files changed

+51
-12
lines changed

src/test/regress/expected/nls.out

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,23 @@ CREATE FUNCTION test_translation()
66
RETURNS void
77
AS :'regresslib'
88
LANGUAGE C;
9-
-- Some BSDen are sticky about wanting a codeset name in lc_messages,
10-
-- but it seems that at least on common platforms it doesn't have
11-
-- to match the actual database encoding.
12-
SET lc_messages = 'es_ES.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+
do $$
13+
declare locale text; ok bool;
14+
begin
15+
for locale in values('es_ES'), ('es_ES.UTF-8'), ('es_ES.utf8')
16+
loop
17+
ok = true;
18+
begin
19+
execute format('set lc_messages = %L', locale);
20+
exception when invalid_parameter_value then
21+
ok = false;
22+
end;
23+
exit when ok;
24+
end loop;
25+
end $$;
1326
SELECT test_translation();
1427
NOTICE: traducido PRId64 = 424242424242
1528
NOTICE: traducido PRId32 = -1234

src/test/regress/expected/nls_1.out

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,23 @@ CREATE FUNCTION test_translation()
66
RETURNS void
77
AS :'regresslib'
88
LANGUAGE C;
9-
-- Some BSDen are sticky about wanting a codeset name in lc_messages,
10-
-- but it seems that at least on common platforms it doesn't have
11-
-- to match the actual database encoding.
12-
SET lc_messages = 'es_ES.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+
do $$
13+
declare locale text; ok bool;
14+
begin
15+
for locale in values('es_ES'), ('es_ES.UTF-8'), ('es_ES.utf8')
16+
loop
17+
ok = true;
18+
begin
19+
execute format('set lc_messages = %L', locale);
20+
exception when invalid_parameter_value then
21+
ok = false;
22+
end;
23+
exit when ok;
24+
end loop;
25+
end $$;
1326
SELECT test_translation();
1427
NOTICE: NLS is not enabled
1528
test_translation

src/test/regress/sql/nls.sql

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,23 @@ CREATE FUNCTION test_translation()
99
AS :'regresslib'
1010
LANGUAGE C;
1111

12-
-- Some BSDen are sticky about wanting a codeset name in lc_messages,
13-
-- but it seems that at least on common platforms it doesn't have
14-
-- to match the actual database encoding.
15-
SET lc_messages = 'es_ES.UTF-8';
12+
-- There's less standardization in locale name spellings than one could wish.
13+
-- While some platforms insist on having a codeset name in lc_messages,
14+
-- fortunately it seems that it need not match the actual database encoding.
15+
do $$
16+
declare locale text; ok bool;
17+
begin
18+
for locale in values('es_ES'), ('es_ES.UTF-8'), ('es_ES.utf8')
19+
loop
20+
ok = true;
21+
begin
22+
execute format('set lc_messages = %L', locale);
23+
exception when invalid_parameter_value then
24+
ok = false;
25+
end;
26+
exit when ok;
27+
end loop;
28+
end $$;
1629

1730
SELECT test_translation();
1831

0 commit comments

Comments
 (0)