Default value for case sensitive on uniqueness validator


The uniqueness validator was always case sensitive but that seems wrong because we want uniqueness validations to be insensitive in most of the time.

Do not make more sense be insensitive by default and set sensitive only where it should be?

We are migrating a lot of big applications from mysql to postgresql here and we are setting case sensitive to false on **all** uniqueness validations.

Note: mysql do not differ case by default, so, it work as insensitive in all situations.

Rails will change the major version on 4.0 release and could be a great time to do that if core team agree :slight_smile:


Gabriel Sobrinho

Yeah that was tricky for me too. I've migrated the database of the Grails application I maintain from MySql to PostgreSQL a while ago and as a side effect some users complaint that they were no longer able to login. Then I figured out that the username was case insensitive before as a side effect of using MySql. In my case I changed the application to fetch the user using a case insensitive search (ilike) to keep up with the old behavior.

So I guess being case insensitive is good by default specially for user-names so that you would get rid of situations where the user names are different with regards to case sensitive. This is specially true if you intend to migrate from PG to MySql and would have conflicts in the migration path.