This project is archived and is in readonly mode.

#3174 ✓resolved
James Le Cuirot

Add support for PostgreSQL citext column type

Reported by James Le Cuirot | September 9th, 2009 @ 04:09 PM | in 3.0.2

I've just migrated from MySQL to PostgreSQL and I was really surprised to find that text columns are actually case sensitive. The workarounds were ugly and awkward to do in Rails, I think, but then I found the new citext column type. It's available as an add-on for 8.3 and it's included as an add-on for 8.4.

I needed to get this going quickly so I added support for a new citext column type which, as far as Rails is concerned, behaves just like a regular text column. It occurred to me afterwards that maybe I could have implemented it as a :case_sensitive option on the regular text column type to make switching between databases easier. MySQL doesn't have a converse case sensitive column type (right?) so the option would be ineffective there but I still think this would be the better option. I'm short on time at the moment though and this is better than nothing for people that need it.

There are no tests because they would require the extension to be installed, not just on the filesystem, but via SQL as well. It works with my app against 2-3-stable though. I haven't tried it against master but the other tests are still passing in both cases.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages