How does postgresql modify character ordering?

Environment:

PostgreSQL 9.4.1 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.7.2-5) 4.7.2, 64-bit

question:

in the current Linux system, the character sorting rule of the database is en_US.utf8, so that the Chinese sorting is not the desired result. We want to change the sorting rule of the whole database to zh_CN.UTF-8, to ensure the sorting reliability.

but when you create a database, you cannot specify that the collcollate, use pgAdmin3 to create the database, and the character sort drop-down box does not have this option.

how do I set up the zh_CN.UTF-8 collation so that I can use it when I create a new database?
find the inidb way to specify locale, on the Internet. Can I only reinitialize the tablespace?

clipboard.png

Apr.11,2021

it is recommended that you use the psql console to execute CREATE DATABASE statements.

in addition, the LC_COLLATE option is subject to the ENCODING option and the system's own locale. For more information, you can take a look at the notes on LC_COLLATE and LC_CTYPE in PG's official manual ( Notes )

.

https://www.postgresql.org/do.

Menu