:neil_middleton

Ruby on Rails, Web Application Development and bollocks extraordinaire 
« Back to blog

Case Insensitive searching with PostgreSQL

Earlier today (well, a few minutes ago), I had a requirement to make an existing LIKE search case-insensitive with PostgreSQL.

Normally this would prove to be messy, by trying dirty tricks such as downcase-ing content in the search (using UPPER and LOWER) - however, it's pretty straightforward.

For instance, the case-sensitive code would be something like:

Whereas, to make it case-insensitive, try a bit of Borat:

Job done.

Comments (0)

Leave a comment...