Re: Locale agnostic unicode text - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Locale agnostic unicode text
Date
Msg-id 25829.1106431782@sss.pgh.pa.us
Whole thread Raw
In response to Locale agnostic unicode text  (Dawid Kuroczko <qnex42@gmail.com>)
Responses Re: Locale agnostic unicode text  (Dawid Kuroczko <qnex42@gmail.com>)
List pgsql-hackers
Dawid Kuroczko <qnex42@gmail.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [pgsql-hackers-win32] %2$, %1$ gettext placeholder replacement is not working under Win32
Next
From: "Jim C. Nasby"
Date:
Subject: Re: Extending System Views: proposal for 8.1/8.2