PostgreSQL sorting with Cyrillic "ь" PostgreSQL sorting with Cyrillic "ь" postgresql postgresql

PostgreSQL sorting with Cyrillic "ь"


PostgreSQL relies on the operating system's locale to sort.

See how Ubuntu 14.04 sorts that list:

# locale-gen uk_UA.UTF-8Generating locales...  uk_UA.UTF-8... doneGeneration complete.# cat >fileьачьчачльчла# LC_ALL=uk_UA.UTF-8 sort fileачачльчлачьь

In the comments you say it's different but what I get here is exactly the same order as your query.

Indeed чль comes before чла which intuitively is weird but I don't know cyrillic.

You may look at /usr/share/i18n/locales/uk_UA for the definition of the locale, and bring it up as an ubuntu bug of the locales packages.


So, the solutions has been completed in these steps:

  1. Searched the Internet and http://linux.org.ua/ for any information; found http://linux.org.ua/cgi-bin/yabb/YaBB.pl?num=1407783417/6#6
  2. Starred at bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=17293, fixed 2015-05-26
  3. Checked glibc version (2.19 now)
  4. Grabbed a patch; edited the patch (removed the section for Makefile)
  5. Backed /usr/share/i18n/locales/uk_UA up
  6. Patched it with [cd /usr/share/i18n/;] patch --dry-run -p2 < locales_uk_UA_softsign.diff --- then with no --dry-run.
  7. locale-gen
  8. service postgresql restart