Debugging postgresql for where 'A' < 'a'

天大地大妈咪最大 提交于 2019-12-06 09:14:32

Ordering depends on your database locale, not system locale. (Though it should be noted that PostgreSQL relies on the OS to provide specifics. More in the Postgres Wiki.)
The ASCII value is only relevant with the non-locale "C".

Take a look at your current settings:

SELECT * FROM pg_settings WHERE name ~~ 'lc%';

In particular, the setting for LC_COLLATE is relevant. You can also:

SHOW lc_collate;

In PostgreSQL 9.1 you can change the applicable collation per statement. Try:

SELECT 1 AS one WHERE 'A' < 'a' COLLATE "C";

In older versions you are (mostly) stuck with the value for LC_COLLATE that you chose when creating your database cluster.

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