Patch for collation using ICU - Mailing list pgsql-hackers

From Palle Girgensohn
Subject Patch for collation using ICU
Date
Msg-id D4499599155880AAEA4319AE@palle.girgensohn.se
Whole thread Raw
Responses Re: Patch for collation using ICU  (Palle Girgensohn <girgen@pingpong.net>)
Re: Patch for collation using ICU  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
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/>



pgsql-hackers by date:

Previous
From: "Dave Page"
Date:
Subject: Re: Upcoming 8.0.2 Release
Next
From: Tom Lane
Date:
Subject: Re: Upcoming 8.0.2 Release