Postgresql cannot be sorted in Korean order.

Asked 2 years ago, Updated 2 years ago, 72 views

SELECT * FROM table_name ORDER BY title but the title cannot be sorted in Korean order and can be sorted as it pleases. < may appear before < and it looks random.

(1) SELECT* FROM table_name ORDER BY title collate "C" works well, but what is collate "C"?

(2) Postgresql installed on a Mac can be sorted well without color "C" and cannot be sorted only on postgresql installed on Linux. Did I do something wrong when I set up the DB?

postgresql sorting

2022-09-22 21:35

1 Answers

To make COLLATE C with DEFAULT, you can specify the database creation COLLATE with initdb.

# initdb-EUTF-8 --lc-colate=C-W-D <Location>

Or if postgresql server works with environment variable set to LC_COLLATE=C. (I haven't tested it, so I'm not sure.)

Consider migrating an existing database to make changes as follows:


2022-09-22 21:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.