Re: Sigh, LIKE indexing is *still* broken in foreign locales - Mailing list pgsql-hackers

From Giles Lean
Subject Re: Sigh, LIKE indexing is *still* broken in foreign locales
Date
Msg-id 5852.960497121@nemeton.com.au
Whole thread Raw
In response to Re: Sigh, LIKE indexing is *still* broken in foreign locales  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses RE: Sigh, LIKE indexing is *still* broken in foreign locales  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
List pgsql-hackers
On Thu, 08 Jun 2000 10:04:11 -0400  Tom Lane wrote:

> The bounds do not have to be perfectly tight, in the sense of being
> the least string >= or largest string <= the desired strings.  It's
> OK if we scan a few extra tuples in some cases.  But we have to have
> reasonably close bounds or we can't implement LIKE with an index.

Determining the bounding (sub-)strings looks like a very hard problem.

I think there is enough information in a POSIX locale to determine
what the rules for constructing such bounds would be ... but there is
no programatic interface to determine the rules a locale uses for
collation.  (I have no idea what non-POSIX systems provide.)

(The localedef program can build a locale.  strcoll() and strxfrm()
can use the collation information.  That's all I see.)

In the absence of a way to do this "right" we need someone to see a
"good enough" hack that happens to work everywhere, or else give up
using indexes for LIKE which I doubt would please anyone.  I suppose
the mismatch comes about because LIKE is about pattern matching and
not collation. :(

Regards,

Giles


pgsql-hackers by date:

Previous
From: Don Baccus
Date:
Subject: Re: Proposal: TRUNCATE TABLE table RESTRICT
Next
From: "Hiroshi Inoue"
Date:
Subject: RE: DROP COLUMN status