pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Robinson <robinson@netrinsics.com>
To: pgsql-hackers@hub.org
Subject: Re: [HACKERS] Postgres 6.5 beta2 and beta3 problem
Date: Thu, 10 Jun 1999 10:14:10 +0800 (CST)
Message-ID: <199906100214.KAA11420@netrinsics.com> (raw)

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




view thread (41+ messages)  latest in thread

Message-ID: <199906100214.KAA11420@netrinsics.com>
Permalink:  ../199906100214.KAA11420@netrinsics.com/
Also on:    postgresql.org/message-id/199906100214.KAA11420@netrinsics.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: robinson@netrinsics.com, pgsql-hackers@hub.org
  Subject: Re: [HACKERS] Postgres 6.5 beta2 and beta3 problem
  In-Reply-To: <199906100214.KAA11420@netrinsics.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox