Skip site navigation (1) Skip section navigation (2)

Re: Locale agnostic unicode text

From: Dawid Kuroczko <qnex42(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Locale agnostic unicode text
Date: 2005-01-23 15:54:22
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Sat, 22 Jan 2005 17:09:42 -0500, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > This time setlocale() was needed to get the behaviour
> > I needed (database initdb'ed to 'C', my order set to 'pl_PL',
> > or whatever locale I need at given moment).
> I would imagine that the performance is spectacularly awful :-(.
> Have you benchmarked it?  A large sort on a unitext column,
> for instance, would be revealing.

True.  Yet it would be still better than nothing ("C").  Actually
I was thinking that maybe functional indexes could be
used to boost the speed (at least for ordering).

> > ...but I would like to force ORDER BY using operators
> > provided by me without this 'USING <' clause.
> Hmm, the existence of the default btree operator class should be
> sufficient.

If You (or anyone) could try that SQL file and try to find
missing clause... :)

I guess that the case is that DOMAIN unitext is not quite
another type, so text's default operators sometimes take
precedence over unitext's own. :)

> > CREATE OR REPLACE FUNCTION lower(unitext) RETURNS unitext AS $$
> >       utf8::decode($_[0]);
> >       return lc($_[0]);
> > $$ LANGUAGE plperlu IMMUTABLE;
> AFAIK upper/lower cannot be considered to be locale-independent
> (see Turkish I/i business for a counterexample).

I imagine it is not possible to make 'one size fits all' lower(),
yet perl's uc()/lc() in my opinion for some cases is still
better than choosing one locale or using "C" locale.


In response to


pgsql-hackers by date

Next:From: Stephen FrostDate: 2005-01-23 16:40:25
Subject: Re: [PATCHES] Merge pg_shadow && pg_group -- UNTESTED
Previous:From: Robert TreatDate: 2005-01-23 15:36:50
Subject: Re: 8.1 development cycle (was a couple of other threads

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group