Re: "select ... where field like lower('%text%')" fails

Thomas Lockhart <lockhart@alumni.caltech.edu>

From: Thomas Lockhart <lockhart@alumni.caltech.edu>
To: lists@shortestpath.org, pgsql-bugs@postgresql.org
Date: 2001-03-06T15:21:35Z
Lists: pgsql-bugs
There is no bug. You want case-insensitive pattern matching, which is
not what your call to "tolower()" accomplishes.

The query

  SELECT company from user_tbl where company like lower('%SEaN%');

will find all strings which contain "sean" (note case!). It will not
match strings containing "Sean". Look in the PostgreSQL docs for hints
on how to do case-insensitive searches.

                      - Thomas