admin管理员组

文章数量:1122832

I want to create database on PostgreSQL installation on Alma linux (RedHat derivate) with this command:

CREATE DATABASE "ASP-ACDCliste" WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'Czech_Czechia.1250';

and I get this message back

psql:demo.out:97: ERROR:  invalid LC_COLLATE locale name: "Czech_Czechia.1250"
DOPORUČENÍ:  If the locale name is specific to ICU, use ICU_LOCALE.

What should I do with PostgreSQL or linux installation so that enable there Czech collation and successfully create mentioned table ?

I tried also re-initialize database on server where postgresql is installed and run:

export LANG="cs_CZ.utf8"
/usr/pgsql-16/bin/initdb -D /var/lib/pgsql/16/data

but without success.

I want to create database on PostgreSQL installation on Alma linux (RedHat derivate) with this command:

CREATE DATABASE "ASP-ACDCliste" WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LOCALE = 'Czech_Czechia.1250';

and I get this message back

psql:demo.out:97: ERROR:  invalid LC_COLLATE locale name: "Czech_Czechia.1250"
DOPORUČENÍ:  If the locale name is specific to ICU, use ICU_LOCALE.

What should I do with PostgreSQL or linux installation so that enable there Czech collation and successfully create mentioned table ?

I tried also re-initialize database on server where postgresql is installed and run:

export LANG="cs_CZ.utf8"
/usr/pgsql-16/bin/initdb -D /var/lib/pgsql/16/data

but without success.

Share Improve this question edited Nov 21, 2024 at 14:31 LDonSOvrfw asked Nov 21, 2024 at 14:13 LDonSOvrfwLDonSOvrfw 496 bronze badges 2
  • 1) Czech_Czechia.1250 != cs_CZ.utf8 Also pretty sure ENCODING = 'UTF8' is incompatible with Czech_Czechia.1250, I would say you need cs_CZ.utf8. 2) Do you have Czech_Czechia.1250 locale installed on machine? locale -a will show you. – Adrian Klaver Commented Nov 21, 2024 at 16:52
  • @AdrianKlaver On target is unfortunately only cs_CZ.utf8 (linux vm) so I convert dump (from Windows vm) to replace Czech_Czechia.1250 for cs_CZ.utf8. And it's pass correct. Thank for all comments. – LDonSOvrfw Commented Dec 9, 2024 at 9:23
Add a comment  | 

1 Answer 1

Reset to default 1

Either use an existing C library collation:

CREATE DATABASE "ASP-ACDCliste" 
   TEMPLATE = template0
   ENCODING = UTF8
   LOCALE_PROVIDER = libc
   LOCALE = "cs_CZ.utf8";

or use an ICU locale:

CREATE DATABASE "ASP-ACDCliste" 
   TEMPLATE = template0
   ENCODING = 'UTF8'
   LOCALE_PROVIDER = icu
   ICU_LOCALE = "cs-CZ"
   LOCALE = "cs_CZ.utf8";

本文标签: Enable national collation on PostgreSQL database installationStack Overflow