case insensitive LIKE search in postgres

LabKey Support Forum (Inactive)
case insensitive LIKE search in postgres Ben Bimber  2011-07-27 11:05
Status: Closed
 
if you use labkey's 'contains' filter to do a search, it's case insensitive. what i seemed to be seeing was that if you do a LIKE search through labkey but using raw SQL is that LIKE is case sensitive (which is what postgres is). ILIKE did not seem to be supported. I'm guessing labkey just passes like 'LIKE' through to pg, so we're inheriting postgres' behavior?

Should it be possible to write a SQL statement (not a labkey filter) against postgres that gives a case insensitive LIKE?

Thanks.
 
 
jeckels responded:  2011-07-27 15:49
Hi Ben,

You should be able to use LOWER():

SELECT * FROM MyTable WHERE LOWER(Column1) LIKE '%myvalue%'

Thanks,
Josh
 
Ben Bimber responded:  2011-07-27 16:21
they're not gonna like that. thanks though.