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! ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match