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

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: lists(at)shortestpath(dot)org, pgsql-bugs(at)postgresql(dot)org
Subject: Re: "select ... where field like lower('%text%')" fails
Date: 2001-03-06 15:21:35
Message-ID: 3AA5007F.42835AED@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-03-06 15:35:25 Re: pg_dump -a strangeness/bug? (7.1beta5)
Previous Message Sean Kelly 2001-03-06 11:35:13 "select ... where field like lower('%text%')" fails