Обсуждение: Inconsistent behavior with locale definition in initdb/pg_ctl init

Поиск
Список
Период
Сортировка

Inconsistent behavior with locale definition in initdb/pg_ctl init

От
Matthias van de Meent
Дата:
Hi,

I was working on setting up a PG16.devel(375407f4) test database with
UTF8 but C locale, and found the following strange behaviour:

plain initdb:
[...]
 Using default ICU locale "en_US".
 Using language tag "en-US" for ICU locale "en_US".
 The database cluster will be initialized with this locale configuration:
   provider:    icu
   ICU locale:  en-US
   LC_*:     en_US.UTF-8
 The default database encoding has accordingly been set to "UTF8".
 The default text search configuration will be set to "english".

initdb --no-locale: (documented as "equivalent to --locale=C")
[...]
 The database cluster will be initialized with locale "C".
 The default database encoding has accordingly been set to "SQL_ASCII".
 The default text search configuration will be set to "english".

initdb --locale=C
[...]
 Using default ICU locale "en_US".
 Using language tag "en-US" for ICU locale "en_US".
 The database cluster will be initialized with this locale configuration:
   provider:    icu
   ICU locale:  en-US
   LC_*: C
 The default database encoding has accordingly been set to "UTF8".
 The default text search configuration will be set to "english".

Notably; if initdb chooses the C locale from --no-locale, it uses
SQL_ASCII through libc, but when the C locale is specified through
--locale=C, it somehow defaults to the ICU locale en-US and uses UTF8
as encoding.

In my view that's very unexpected behaviour.

Kind regards,

Matthias van de Meent
Neon (neon.tech)