Re: Locale agnostic unicode text
| От | Tom Lane |
|---|---|
| Тема | Re: Locale agnostic unicode text |
| Дата | |
| Msg-id | 25829.1106431782@sss.pgh.pa.us обсуждение |
| Ответ на | Locale agnostic unicode text (Dawid Kuroczko <qnex42@gmail.com>) |
| Ответы |
Re: Locale agnostic unicode text
|
| Список | 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 по дате отправления: