From: | Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> |
---|---|
To: | Charlie Hornberger <charlie(at)pressflex(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: full-text indexing, locales, triggers, SPI & more fun |
Date: | 2000-06-02 10:08:20 |
Message-ID: | Pine.LNX.3.96.1000602115251.17301A-100000@ara.zf.jcu.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, 31 May 2000, Charlie Hornberger wrote:
> I want to aggregate text in multiple languages in a single full-text index
> much like the current structure used by the current fti() function. In order
> to correctly parse the strings, however, I've got to know what locale
> they're written in/for (otherwise, isalpha() thinks that characters such as
> the Hungarian letter u" -- that's a 'u' with a double acute accent -- aren't
> very alphabetic.)
>
> My initial thinking (which could certainly be very wrong) is that the
> easiest way to get around this would be to allow client apps to set their
> LC_ALL environment variables, and then to have the new fti() function use
> that locale while doing string manipulation.
>
> But the way I'm doing things, it doesn't appear that the LC_ALL environment
> variable is available. (Maybe it was never meant to be ... but I'm not a
> very skilled C programmer, and I don't know the first thing about the SPI
> interface, so please forgive me if I'm asking why the sun doesn't rise in
> the west more often ;-)).
The PostgreSQL set in main() next locale catg. (if you compile it with locale
support)
#ifdef USE_LOCALE
setlocale(LC_CTYPE, "");
setlocale(LC_COLLATE, "");
setlocale(LC_MONETARY, "");
#endif
If you need in your routines ctype.h's functions a solution is a set LANG
env. :
# LANG=Czech (for me)
# start_postmaster
It works very well, and you not need any other setting.
IMHO use setlocale(LC_ALL, ..) is a very strong hard to backend, because
a example all float data will crashed.
If you (still:-) need all locales see pg_locale.c in pg's sources in
utils/atd and usage of these routines in formatting.c (to_char()) which use
full locale for numbers.
But don't remember - you must always return all to state before LC_ALL.
Karel
From | Date | Subject | |
---|---|---|---|
Next Message | Keith Parks | 2000-06-02 12:16:33 | Re: Problems with recent CVS versions and Solaris. |
Previous Message | Kovacs Zoltan | 2000-06-02 10:06:58 | Re: announcing pgbrowse |