How can I achieve the same Postgres collation behavior in Linux as that in Mac OS?

喜你入骨 提交于 2019-12-05 05:36:14

The locales on OS X are sufficiently broken and the ones on Linux (glibc) are sufficiently not, so that you are going to have difficulties sorting this out successfully. The only way would be to use the lowest common denominator, which is the C locale. But if you are developing an application that actually depends on useful natural-language collation behavior, you need to do it on the same platform that you use in production. I suggest setting up a virtual box running Linux on your OS X machine.

You can control the collation used when you CREATE DATABASE - see the LC_COLLATE option to CREATE DATABASE.

PostgreSQL will use the underlying operating system collation routines, so you can't always get an exact match if the OSes don't offer exactly the same locales or their implementations differ. Adding support for using ICU to do internal OS-independent collation has long been on the wishlist, but it's a huge job that nobody has wanted badly enough to do yet.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!