Re: Patch for collation using ICU - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Patch for collation using ICU
Date
Msg-id 200505070257.j472vxg01285@candle.pha.pa.us
Whole thread Raw
In response to Patch for collation using ICU  (Palle Girgensohn <girgen@pingpong.net>)
Responses Re: Patch for collation using ICU  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Patch for collation using ICU  (Palle Girgensohn <girgen@pingpong.net>)
List pgsql-hackers
Is this patch ready for application?
http://people.freebsd.org/~girgen/postgresql-icu/pg-802-icu-2005-05-06.diff.gz

The web site is:
http://people.freebsd.org/~girgen/postgresql-icu/readme.html

I do have a few questions:

Why don't you use the lc_ctype_is_c() part of this test?
    if (pg_database_encoding_max_length() > 1 && !lc_ctype_is_c())

Why is so much code added, for example, in lower()?  The existing
multibyte code is much smaller, and lots of code is added in other
places too.

Why do you need to add a mapping of encoding names from iana to our
names?

---------------------------------------------------------------------------

Palle Girgensohn wrote:
> Hi!
> 
> I've put together a patch for using IBM's ICU package for collation.
> 
> If your OS does not have full support for collation ur uppercase/lowercase 
> in multibyte locales, this might be useful. If you are using a multibyte 
> character encoding in your database and want collation, i.e. order by, and 
> also lower(), upper() and initcap() to work properly, this patch will do 
> just that.
> 
> This patch is needed for FreeBSD, since this OS has no support for 
> collation of for example unicode locales (that is, wcscoll(3) does not do 
> what you expect if you set LC_ALL=sv_SE.UTF-8, for example). AFAIK the 
> patch is *not* necessary for Linux, although IBM claims ICU collation to be 
> about twice as fast as glibc for simple western locales.
> 
> It adds a configure switch, `--with-icu', which will set up the code to use 
> ICU instead of wchar_t and wcscoll.
> 
> This has been tested only on FreeBSD-4.11 & FreeBSD-5-stable, where it 
> seems to run well. I've not had the time to do any comparative performance 
> tests yet, but it seems it is at least not slower than using LATIN1 with 
> sv_SE.ISO8859-1 locale, perhaps even faster.
> 
> I'd be delighted if some more experienced postgresql hackers would review 
> this stuff. The patch is pretty compact, so it's fast reading :)  I'm 
> planning to add this patch as an option (tagged "experimental") to 
> FreeBSD's postgresql port. Any ideas about whether this is a good idea or 
> not?
> 
> Any thoughts or ideas are welcome!
> 
> Cheers,
> Palle
> 
> Patch at:
> <http://people.freebsd.org/~girgen/postgresql-icu/pg-801-icu-2005-03-14.diff>
> 
> ICU at sourceforge: <http://icu.sf.net/>
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: rendezvous
Next
From: Tom Lane
Date:
Subject: Re: Patch for collation using ICU