Re: Setting locale per connection - Mailing list pgsql-hackers

From Stephan Szabo
Subject Re: Setting locale per connection
Date
Msg-id 20030701211052.D66304-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Re: Setting locale per connection  (Behdad Esfahbod <behdad@bamdad.org>)
List pgsql-hackers
On Wed, 2 Jul 2003, Behdad Esfahbod wrote:

> On Tue, 1 Jul 2003, Stephan Szabo wrote:
>
> >
> > On Wed, 2 Jul 2003, Behdad Esfahbod wrote:
> >
> > > I'm new to the list, so don't flame at the first date ;).
> > >
> > > I usually use PostgreSQL for multiple languages, so I needed to
> > > set locale per connection, or can change the locale on the fly.
> > > I don't know if there is any such ability integrated in or not,
> > > so I have wrote my 10lines function as a wrapper around
> > > setlocale, that is attached.  So what I do is just a simple
> > > "SELECT locale('LC_COLLATE', 'fa_IR');" at connection time. Let
> > > me know if there is any standard way already implemented.
> >
> > Hmm, I'd think there'd be some potential for danger there.  I don't play
> > with the locale stuff, but if the collation changes and you've got indexed
> > text (varchar, char) fields, wouldn't the index no longer necessarily be
> > in the correct order?
>
> I read in the FAQ that indexes for text fields is used just if
> default C locale is used during initdb, well, humm, is not the

Indexes are only used for LIKE queries on the "C" locale, but they
should be used for standard =, <, >, etc queries in the other locales
so you may still run into trouble.



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: cvs build failure
Next
From: Bruce Momjian
Date:
Subject: Re: cvs build failure