Re: [HACKERS] Sigh, LIKE indexing is *still* broken in foreign locales

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Moucha Václav <MouchaV(at)Radiomobil(dot)cz>, pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Sigh, LIKE indexing is *still* broken in foreign locales
Date: 2000-06-09 00:57:56
Message-ID: Pine.LNX.4.21.0006081922450.23619-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Tom Lane writes:

> Evidently the collation rule is that different accent forms sort the
> same unless the strings would otherwise be considered equal, in which
> case an ordering is assigned to them.

Yes, that's fairly common.

> I am now thinking that maybe we should search for a string that compares
> greater than "fooz" when the prefix is "foo" --- that is, append a 'z'
> to the prefix string. But I wouldn't be surprised if that fails too
> in some locales.

It most definitely will. sv_SE, no_NO, and hr_HR are the early candidates.
And there's also nothing that says that you can only use LIKE on letters,
Latin letters at that.

The only thing you can really do in this direction is to append the very
last character in the complete collation sequence, if there's a way to
find that out. If there isn't, it might be worth hard-coding a few popular
ones.

> I'm also wondering if the left-hand inequality ('foo' <= any string
> beginning with 'foo') might fail in some locales ... we haven't seen
> it reported but who knows ...

I think that's pretty safe. Shorter strings are always "less than" longer
ones.

--
Peter Eisentraut Sernanders väg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Hiroshi Inoue 2000-06-09 02:03:11 RE: Sigh, LIKE indexing is *still* broken in foreign locales
Previous Message Erich Stamberger 2000-06-09 00:25:52 Re: Sigh, LIKE indexing is *still* broken in foreign locales

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2000-06-09 01:07:16 Re: Proposal: TRUNCATE TABLE table RESTRICT
Previous Message Erich Stamberger 2000-06-09 00:25:52 Re: Sigh, LIKE indexing is *still* broken in foreign locales