18

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.

2
  • Can you give reasons for the solutions you don't want. Maybe there is another way you haven't thought of? I can guess at problems with lower/upper, but citext avoids these: as with a custom collation, it adjusts the meaning of = so that the case-insensitivity is transparent to calling code. Commented Sep 15, 2013 at 22:24
  • I could not agree more with your question. Need the same thing myself. Did you solve it? If yes, please add your own answer. Commented Nov 11, 2013 at 11:24

2 Answers 2

4

"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"

Sign up to request clarification or add additional context in comments.

Comments

3

Doesn't seem to be possible within Postgres iteself:

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

1 Comment

I don't care where the collation definition will come from. It might be from the OS, downloaded from the net, etc .. I just want them to be available to the DB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.