Re: An idea on faster CHAR field indexing - Mailing list pgsql-hackers

From Tom Lane
Subject Re: An idea on faster CHAR field indexing
Date
Msg-id 7014.961642876@sss.pgh.pa.us
Whole thread Raw
In response to Re: An idea on faster CHAR field indexing  ("Randall Parker" <randall@nls.net>)
List pgsql-hackers
"Randall Parker" <randall@nls.net> writes:
> On Thu, 22 Jun 2000 11:12:54 +1000, Giles Lean wrote:
>> Yes.  Some locales want strings to be ordered first by ignoring any
>> accents on chracters, then using a tie-break on equal strings by doing
>> a comparison that includes the accents.

> I guess I don't see how this is really any different. Why order first
> by the character and second by the accent? For instance, if you know
> the relative order of the various forms of "o" then just give them all
> successive numbers and do a single pass sort. You just have to make
> sure that all the numbers in that set of numbers are greater than the
> number you assign to "m" and less than the number you assign to "p".

Nope.  Would it were that easy.  I don't have a keyboard that will
let me type a proper example, but consider

1.    a  o-with-type-1-accent  c

2.    a  o-with-type-2-accent  b

If type-1 accent sorts before type-2 then your proposal will consider
string 1 less than string 2.  But the correct answer (in these locales)
is the other way round, because you mustn't look at the accents at all
unless you discover that the strings are otherwise equal.  The
determining comparison here is that b < c, therefore string 2 < string 1.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Big 7.1 open items
Next
From: Tom Lane
Date:
Subject: Re: Big 7.1 open items