From 6662c173b7cac45083567cc4aaac73316613c45c Mon Sep 17 00:00:00 2001 From: gnsngck Date: Sat, 26 May 2018 01:43:38 +0900 Subject: [PATCH] Adding C collate on initdb PostgreSQL has a problem to sort some non-latin characters using `ORDER BY` and the known solution is setting `LC_COLLATE` to C.[1][2] Because `LC_COLLATE` is fixed when running `initdb`, it is preclusive to set collation on post installation script for new user. [1]: https://stackoverflow.com/questions/14191848/postgresql-order-by-is-very-weird [2]: https://stackoverflow.com/questions/43745639/sort-order-in-postgresql-for-japanese-words-in-hiragana --- postgresql.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgresql.json b/postgresql.json index fda071419c..c4cc709336 100644 --- a/postgresql.json +++ b/postgresql.json @@ -25,7 +25,7 @@ "PGDATA": "$dir\\data" }, "post_install": " - if (!(Test-Path \"$dir\\data\\pg_hba.conf\")) { iex \"initdb --username=postgres --encoding=UTF8 --locale=en\" } + if (!(Test-Path \"$dir\\data\\pg_hba.conf\")) { iex \"initdb --username=postgres --encoding=UTF8 --locale=en --lc-collate=c\" } ", "notes": "To start/stop service, run `pg_ctl start`, `pg_ctl stop`.", "checkver": {