Re: Locale agnostic unicode text

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dawid Kuroczko <qnex42(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Locale agnostic unicode text
Date: 2005-01-22 22:09:42
Message-ID: 25829.1106431782@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dawid Kuroczko <qnex42(at)gmail(dot)com> writes:
> So... I thoght, why not use this unitext to sort texts?
> So I've created functions, operators and operator class,
> 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.

> ...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.

> 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).

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message lsunley 2005-01-22 22:35:45 Re: Extending System Views: proposal for 8.1/8.2
Previous Message Tom Lane 2005-01-22 22:05:22 Re: [HACKERS] %2$, %1$ gettext placeholder replacement is not working under Win32