I am wondering how rails handles case sensitivity in databases. If I
do a Person.find_all_by_name(“tim”) in mysql I would expect to get
tim, TIm, and Tim. Do I only get tim in postgres?
How do other people deal with this? Do you resort to find_by_sql for
all your postgres queries to get case insensitive results?
I guess that would work but it seems like a hassle to try and override
all the find_by methods. I wonder if it would be wise to override the
missing_method and intercept all find and find_by calls. I think I
remember the find_by methods are implemented via the missing method
intercept.
On the downside this means making a ton of function indexes in postgres.
I was really hoping to avoid such a thing if at all possible, not only
because it breaks the database abstraction but also because it
probably won’t use an index.
I was really hoping to avoid such a thing if at all possible, not only
because it breaks the database abstraction but also because it
probably won’t use an index.
Check to see the actual query run from your development.log then pop
that
into psql with an “EXPLAIN” and see what postgres will do.
I’d be surprised if it didn’t use the index, unless the stats indicate
it
shouldn’t regardless…
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.