I'm using Postgres with Kohana 3's ORM module and would like to run a SELECT using a postgres function to convert values already in the database to lower case before doing the comparison.
In SQL I would write:
select * from accounts where lower(email) = '[email protected]';
In Kohana I would like to write something like this:
$user = ORM::factory('user')
->where('lower(email)', '=', strtolower('[email protected]'))
->find();
But this gives an error because ORM is trying to deduce the column name as 'lower(email)' rather than just 'email'.
I'm new to Kohana and ORM so alternatives that would give me the same result would be useful too.