问题
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