Add case insensitive collation to PostgreSQL

…衆ロ難τιáo~ 提交于 2019-12-21 03:42:47

问题


By default, PostgreSQL comes without case insensitive collations. Its documentation describes a way to add new collations based on OS locales, e.g.:

http://www.postgresql.org/docs/9.1/static/sql-createcollation.html

however the created collations are case sensitive.

My question is: How to add a case INsensitive collation to a PostgreSQL server ?

Can somebody describe a workflow ?

I was not able to find any references on the net, while some people mention that it is possible. I've tested with v9.1 - Debian GNU/Linux and v9.2 on Windows.

Just to clarify that I'm aware of:

  • PostgreSQL CITEXT add-on data type
  • Usage of LOWER/UPPER for searches and indexes.

These are not the solutions that I want.


回答1:


Doesn't seem to be possible within Postgres iteself:

Not from the Postgres project -- we just use the collations supplied by the operating system.




回答2:


"Nondeterministic collations" were added to Version 12:

"The most typical use case for nondeterministic collations is probably the case-insensitive comparison. At secondary strength, strings that differ by case compare as equal"



来源:https://stackoverflow.com/questions/17422054/add-case-insensitive-collation-to-postgresql

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