Re: [HACKERS] Postgres 6.5 beta2 and beta3 problem

Поиск
Список
Период
Сортировка
От Michael Robinson
Тема Re: [HACKERS] Postgres 6.5 beta2 and beta3 problem
Дата
Msg-id 199906100214.KAA11420@netrinsics.com
обсуждение исходный текст
Список pgsql-hackers
Hannu Krosing <hannu@trust.ee> writes:
>in single-byte locales it should be easy:

If you do it right, in double-byte locales as well.

>1. sort a char[256] array from 0-255 using the current locale settings,
> do it once, either at startup or when first needed.

Or, alternatively, maintain per-locale table files and mmap them.

>2. use binary search on that array to locate the last char before %
> in this sorted array:

Or, alternatively, maintain another table that maps char values to
lexicographic order (and a per-locale constant for maximum character
order value):

> if (it is not the last char in sorted array)
> then (replace that char with the one at index+1)
> else (
>   if (it is not the first char in like string)
>   then (discard the last char and goto 2.
>   else (don't do the end restriction)
> )
if ( (nextindex = charorder[c]+1) <= maxchar ) {    nextchar = charmap[nextindex];} else {    no nextchar, append
charmap[maxchar]to LIKE base string}
 

I don't see where the pain is, but I may be missing something.
-Michael Robinson



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: [HACKERS] Postgres 6.5 beta2 and beta3 problem
Следующее
От: Vadim Mikheev
Дата:
Сообщение: Re: Real Programmers (was: [HACKERS] Priorities for 6.6)