4

I am using the postgres version 9.4.1 64-bit on windows 7 64-bit. I need to create DB with the setting "case sensitive = OFF" but couldn't make this work. I refereed already many question on SO and other forums as well but even after trying out all those options my DB is still case sensitive and my search queries returns only partial results.

Does any one have success getting this work on windows environment?

Note: I am aware of the ILIKE operator but that option is not going to be considered by Architect team as we have a clear requirements that Database storage should be CASE INSENSITIVE by default. We do ot have any scenarios where we will need case sensitive search.

enter image description here

enter image description here

1

You should take a look at my recent answer here to a related question regarding umlauts.

Basically, the solution involves a "shadow" or "search" column for proper names. Basically, you use an ON INSERT trigger to populate your search column with the field you wish to search modified for your chosen search method - in this example, case insensitive.

The example I gave was using Irish names

Display_Name    Search_name    Address
------------    -----------    -------
Ronan MacGuire  RONAN MCGUIRE  1 Clontarf D1
Ronan McGuire   RONAN MCGUIRE  2 Malahide D2
Rónán Mcguire   RONAN MCGUIRE  3 Mary's terrace D3

Ignore the bits about Mc/Mac, just concentrate on the last Display_Name "Rónán Mcguire" - in the Search_Name column, this is changed to RONAN MCGUIRE - and any search for MCGUIRE will also pick up the second person "Ronan McGuire". This has the advantage of being portable/RDBMS agnostic. Maybe this could be a solution to your problem?

  • 1
    It is a good solution if I needed this for any specific Table/Column. But but this is really impractical for me to do for all string columns in all tables. I need to propose something to Architect team that is supported by DB engine natively, for example like SQL server Does. – Anup Shah May 12 '15 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.