Re: ORDER BY different locales for 8.0

From: Mario Weilguni <mweilguni(at)sime(dot)com>
To: "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ORDER BY different locales for 8.0
Date: 2005-04-20 06:36:28
Message-ID: 200504200836.28871.mweilguni@sime.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Am Dienstag, 19. April 2005 09:18 schrieb Honza Pazdziora:
> Hello,
>
> the nls_string function that makes it possible to sort by arbitrary
> locale has been updated to reflect the changes in error handling in
> PostgreSQL 8.0, due to users using the nls_string sorting on 7.4 and
> requesting it for 8.0 as well. The distribution can be downloaded from
>
> http://www.fi.muni.cz/~adelton/l10n/
>
> http://www.fi.muni.cz/~adelton/l10n/postgresql-nls-string/postgresql-nls-st
>ring-8.01.tar.gz
>
> I'll appreciate any comments.
>
> The README is as follows:
>
> -----------------
> Why this function:
>
> PostgreSQL, at least until version 8.0, has rather weak support for
> various collating sequences -- what you get when you do
>
> select ... order by column.
>
> The sorting is closely tied to indexes used throughout the database
> cluster and is specified by locale settings at the initdb time.
> Yet, people asked for ways of specifying the collating rules at runtime,
> even if the sorting will not use indexes. Just take the records and
> sort them. It is reasonable request to want one select to order by
> using English rules, another one to run with German rules and yet
> another with Czech ones, without having to dump, initdb, restore.

Cool. I'm working on a multi-lingual database, so this is exactly what I
looked for. The only disatvantage is the length of the resulting strings,
it's around 9 time longer than the original string.

Just a suggestion:
Could it be done better by not returing a string, but a non-locale affected
representation like some sort of byte array, so the size could be reduced
alot?

However, extremly useful. Thanks!

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Klaus Naumann 2005-04-20 07:28:26 Re: Problem with PITR recovery
Previous Message Christopher Kings-Lynne 2005-04-20 06:20:11 Foreign keys on array elements