Re: ILIKE vs indices

From: Greg Stark <stark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: James Cloos <cloos(at)jhcloos(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ILIKE vs indices
Date: 2012-12-29 14:05:51
Message-ID: CAM-w4HNnap-a3O1+1QgiCA1YaiAy4sqqH-Efj695=HY4HvM1iQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 28, 2012 at 11:41 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> James Cloos <cloos(at)jhcloos(dot)com> writes:
>> Is there any contraindication to recasting:
>> foo ILIKE 'bar'
>> into:
>> LOWER(foo) LIKE LOWER('bar')
>
> In some locales those are not equivalent, I believe, or at least
> shouldn't be. (What the current code actually does is a separate
> question.)

What it actually does is actually *precisely* the above.

I can't quite wrap my head around the idea of "LIKE" and collations
having any meaningful interaction anyways. I certainly can't come up
with anything better than "lower() like lower()" (or "upper() like
upper()").

It would be nice to document what ILIKE actually means. Right now it's
kind of mysterious. And if we can't come up with anything better than
"lower() like lower()" then why not go ahead and document it and take
advantage of it.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2012-12-29 14:12:07 Re: Proposal: Store "timestamptz" of database creation on "pg_database"
Previous Message Dimitri Fontaine 2012-12-29 14:02:41 Re: Event Triggers: adding information