Tom Lane writes:
> Peter Eisentraut <peter_e@gmx.net> writes:
> > I have had an idea how the LIKE optimization problem could be solved.
>
> Hmm ... so in a non-ASCII locale, we'd have to look for an index on
> strxfrm(A) rather than directly on A. And the index would need to
> use a nonstandard operator set --- ie, *non* locale aware comparison
> operators (which might be useful for other purposes anyway).
Wait, why isn't that the solution in the first place. Let's build the
index with an opclass that uses plain strcmp comparison. Then you can
compute the bounds using the method 'foo' <= 'foo%' <= 'fop'. We don't
need to trick the locale facilities, we just avoid using them. LIKE is
defined in terms of character elements, not collation elements, so that's
okay.
--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter