ILIKE in Postgres

43 views
Skip to first unread message

Ashley Moran

unread,
Jul 4, 2009, 8:34:26 AM7/4/09
to DataMapper
Hi

Does anyone know a good way to use ILIKE in Postgres? I really want
to do this:

Model.all(:name.ilike => "%some_text%")

But DataMapper only supports

Model.all(:name.like => "%some_text%")

Which means you have to get the case correct in the search text.

Thanks
Ashley

--
http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran
http://aviewfromafar.net/
http://twitter.com/ashleymoran


Martin Gamsjaeger

unread,
Jul 5, 2009, 6:52:50 AM7/5/09
to datam...@googlegroups.com
Ashley,

You could always fall back to the "classic" condition syntax, so something like

Model.all(:conditions => [ "name ILIKE ?", term ])

should work.

cheers
snusnu

Ashley Moran

unread,
Jul 5, 2009, 7:39:19 AM7/5/09
to DataMapper

On 5 Jul 2009, at 11:52, Martin Gamsjaeger wrote:

> You could always fall back to the "classic" condition syntax, so
> something like
>
> Model.all(:conditions => [ "name ILIKE ?", term ])


Thanks!

Reply all
Reply to author
Forward
0 new messages