如何在Linux中获得与Mac OS中相同的Postgres整理行为? [英] How can I achieve the same Postgres collation behavior in Linux as that in Mac OS?

查看:72
本文介绍了如何在Linux中获得与Mac OS中相同的Postgres整理行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mac OS(开发版)和Linux(生产服务器)之间切换时,Postgres的排序规则会更改,因为Postgres中的排序规则取决于基础操作系统配置。

When switching between Mac OS (development) to Linux (production server), the collation for Postgres changes since collation in Postgres is dependent on the underlying operating system config.

如何在Linux中实现与Mac OS中相同的Postgres整理行为?

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

我正在运行Postgres 9.2

I am running Postgres 9.2

推荐答案

OS X上的语言环境已经足够坏了,而Linux(glibc)上的那些已经足够坏了,因此您将很难成功地进行分类。唯一的方法是使用最低的公分母,即C语言环境。但是,如果您要开发的应用程序实际上依赖于有用的自然语言整理行为,则需要在生产环境中使用的同一平台上进行操作。我建议在OS X计算机上设置一个运行Linux的虚拟机。

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.

这篇关于如何在Linux中获得与Mac OS中相同的Postgres整理行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆