Fix test failures when language environment is not UTF-8.

For tests that depend on UTF-8 encoding, force LC_COLLATE=C and
LC_CTYPE=C to avoid an encoding mismatch.

Reported-by: Thomas Munro
Discussion: https://postgr.es/m/CA+hUKGK-ZqV1njkG_=xcCqXh2fcMkz85FTMnhS2opm4ZerH=xw@mail.gmail.com
This commit is contained in:
Jeff Davis 2024-04-04 16:10:12 -07:00
parent e57fe3824e
commit e2a2357671
2 changed files with 4 additions and 0 deletions

View File

@ -200,6 +200,7 @@ command_ok(
[ [
'initdb', '--no-sync', 'initdb', '--no-sync',
'--locale-provider=builtin', '-E UTF-8', '--locale-provider=builtin', '-E UTF-8',
'--lc-collate=C', '--lc-ctype=C',
'--builtin-locale=C.UTF-8', "$tempdir/data8" '--builtin-locale=C.UTF-8', "$tempdir/data8"
], ],
'locale provider builtin with -E UTF-8 --builtin-locale=C.UTF-8'); 'locale provider builtin with -E UTF-8 --builtin-locale=C.UTF-8');
@ -208,6 +209,7 @@ command_fails(
[ [
'initdb', '--no-sync', 'initdb', '--no-sync',
'--locale-provider=builtin', '-E SQL_ASCII', '--locale-provider=builtin', '-E SQL_ASCII',
'--lc-collate=C', '--lc-ctype=C',
'--builtin-locale=C.UTF-8', "$tempdir/data9" '--builtin-locale=C.UTF-8', "$tempdir/data9"
], ],
'locale provider builtin with --builtin-locale=C.UTF-8 fails for SQL_ASCII' 'locale provider builtin with --builtin-locale=C.UTF-8 fails for SQL_ASCII'

View File

@ -143,6 +143,7 @@ $node->command_ok(
[ [
'createdb', '-T', 'createdb', '-T',
'template0', '--locale-provider=builtin', 'template0', '--locale-provider=builtin',
'--lc-collate=C', '--lc-ctype=C',
'-E UTF-8', '--builtin-locale=C.UTF8', '-E UTF-8', '--builtin-locale=C.UTF8',
'tbuiltin5' 'tbuiltin5'
], ],
@ -152,6 +153,7 @@ $node->command_fails(
[ [
'createdb', '-T', 'createdb', '-T',
'template0', '--locale-provider=builtin', 'template0', '--locale-provider=builtin',
'--lc-collate=C', '--lc-ctype=C',
'-E LATIN1', '--builtin-locale=C.UTF-8', '-E LATIN1', '--builtin-locale=C.UTF-8',
'tbuiltin6' 'tbuiltin6'
], ],