Re: [HACKERS] Postgres 6.5 beta2 and beta3 problem

From: Michael Robinson <robinson(at)netrinsics(dot)com>
To: pgsql-hackers(at)hub(dot)org
Subject: Re: [HACKERS] Postgres 6.5 beta2 and beta3 problem
Date: 1999-06-10 02:14:10
Message-ID: 199906100214.KAA11420@netrinsics.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hannu Krosing <hannu(at)trust(dot)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

Browse pgsql-hackers by date

  From Date Subject
Next Message Vadim Mikheev 1999-06-10 02:34:28 Re: Real Programmers (was: [HACKERS] Priorities for 6.6)
Previous Message Thomas Lockhart 1999-06-10 01:37:00 Re: [HACKERS] Postgres 6.5 beta2 and beta3 problem