(все БД в кластере такого вида):
                  
                  
                  Name              | postgres
                  
                  
                  Owner             | postgres
                  
                  
                  Encoding          | UTF8
                  
                  
                  Collate           | Russian_Russia.1251
                  
                  
                  Ctype             | Russian_Russia.1251
                  
                  
                  
                  
                  
                  Пытаюсь создать такую же БД на Ubuntu 16.04:
                  
                  
                  initdb_options = '--encoding=UTF8 --locale=ru_RU.cp1251'
                  
                  
                  
                  
                  
                  # locale -a
                  
                  
                  C
                  
                  
                  C.UTF-8
                  
                  
                  en_US.utf8
                  
                  
                  POSIX
                  
                  
                  ru_RU.cp1251
                  
                  
                  
                  
                  
                  Получаю ошибку:
                  
                  
                  Creating new PostgreSQL cluster 10/main ...
                  
                  
                  /usr/lib/postgresql/10/bin/initdb --encoding=UTF8 --data-checksums --locale=ru_RU.cp1251 -D /var/lib/postgresql/10/main --auth-local peer --auth-host md5
                  
                  
                  The files belonging to this database system will be owned by user "postgres".
                  
                  
                  This user must also own the server process.
                  
                  
                  
                  
                  
                  The database cluster will be initialized with locale "ru_RU.cp1251".
                  
                  
                  initdb: encoding mismatch
                  
                  
                  The encoding you selected (UTF8) and the encoding that the
                  
                  
                  selected locale uses (WIN1251) do not match.  This would lead to
                  
                  
                  misbehavior in various character string processing functions.
                  
                  
                  Rerun initdb and either do not specify an encoding explicitly,
                  
                  
                  or choose a matching combination.
                  
                  
                  Error: initdb failed
                  
                  
                  Error: could not create default cluster. Please create it manually with
                  
                  
                  
                  
                  
                  Как-то же она была создана?
                  
                  
                
Впрочем, с такими параметрами: --encoding=WIN1251 --locale=ru_RU.cp1251 кластер БД инициализировался без ошибок. Остаётся загадкой, как его смогли инициализировать с кодировкой UTF8 и локалью Russian_Russia.1251.
Обсуждают сегодня