Re: Proof of concept COLLATE support with patch - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Proof of concept COLLATE support with patch
Date
Msg-id 20050902170437.GC15466@svana.org
Whole thread Raw
In response to Re: Proof of concept COLLATE support with patch  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Fri, Sep 02, 2005 at 12:44:00PM -0400, Tom Lane wrote:
>
> Hmm, the more general page seems to be
>
> http://www.hmug.org/man/3/xlocale.php
>
> This seems to be pretty much exactly what we want, at least API-wise.
> Now, if we can find an implementation of this with a BSD license ;-) ...

Yes it is, it's exactly the same interface as glibc. Windows has them
all with an underscore prefix.

> [ I don't recall at the moment whether Apple publishes all of Darwin
> under a straight BSD license, but that would surely be a good place to
> look first. ]

libc is listed as APSL licence, whatever that means. Something with
that many clauses can't be BSD compatable.

What I wonder is how come Apple implemented all this in their version
yet none of the BSDs got around to it.

I've looked around for Citrus, it appears that NetBSD contains the
latest version and while there's a lot of stuff for LC_CTYPE and charset
conversion, LC_COLLATE didn't appear to be high on their priorities.

I especially liked these fragments from the OpenBSD and NetBSD CVS
repositories. Tom, you've comvinced me, relying on the platform is
silly. We have platforms that don't support LC_COLLATE in one locale,
let alone multiple. FreeBSD thankfully does support it.

http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/string/strcoll.c?rev=HEAD
http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/string/strcoll.c?rev=HEAD
--- snip ---
/** Compare strings according to LC_COLLATE category of current locale.*/
int
strcoll(s1, s2)const char *s1, *s2;
{
_DIAGASSERT(s1 != NULL);_DIAGASSERT(s2 != NULL);
/* LC_COLLATE is unimplemented, hence always "C" */return (strcmp(s1, s2));
}


--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

pgsql-hackers by date:

Previous
From: Mark Wong
Date:
Subject: dbt-4 (tpc-app) kit
Next
From: AgentM
Date:
Subject: Re: Proof of concept COLLATE support with patch