Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-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

pgsql-hackers by date

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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group