PostgreSQL utf8 character comparison

我怕爱的太早我们不能终老 提交于 2019-12-13 06:32:37

问题


I am changing from MySQL to PostgreSQL but can't find equivalent to MySQL's collation utf8_general_ci. What I'm trying to achieve here is to be able to compare strings using general language rules rather then binary comparison, i.e. í = i, š = s, ḩ = h, etc...

Is there a way how to make PostgreSQL search for strings using general language rules?

Many thanks!


回答1:


This is, basically, what most modern postgresql installations will do for you by default. But you may also be interested in initdb options --locale, --lc-collate, etc. (most of those, if not all can also be changed after the database is initialized using .conf file).

You can also specify encoding and IIRC LC_COLLATE and friends when creating database.



来源:https://stackoverflow.com/questions/1423378/postgresql-utf8-character-comparison

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