postgresql_16:4.18.1.4 Locale and Encoding
PostgreSQL 16 > Server Administration > Regression Tests > Running the Tests > Locale and Encoding
By default, tests using a temporary installation use the locale defined in the current environment and the corresponding database encoding as determined by initdb. It can be useful to test different locales by setting the appropriate environment variables, for example: make check LANG=C make check LC_COLLATE=en_US.utf8 LC_CTYPE=fr_CA.utf8 For implementation reasons, setting LC_ALL does not work for this purpose; all the other locale-related environment variables do work.
When testing against an existing installation, the locale is determined by the existing database cluster and cannot be set separately for the test run.
You can also choose the database encoding explicitly by setting the variable ENCODING, for example: make check LANG=C ENCODING=EUC_JP Setting the database encoding this way typically only makes sense if the locale is C; otherwise the encoding is chosen automatically from the locale, and specifying an encoding that does not match the locale will result in an error.
The database encoding can be set for tests against either a temporary or an existing installation, though in the latter case it must be compatible with the installation's locale.