Arbitrary collation support for PostgreSQL

From: Honza Pazdziora <adelton(at)informatics(dot)muni(dot)cz>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Arbitrary collation support for PostgreSQL
Date: 2004-02-26 08:39:39
Message-ID: 20040226083939.GC1680@anxur.fi.muni.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello all,

PostgreSQL, at least until version 7.4, has rather weak support for
various collating sequences. What you get when you do

select * from table order by column

is hardcoded in the database cluster at the initdb time. Yet, 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.

The distribution

http://www.fi.muni.cz/~adelton/l10n/postgresql-nls-string-0.50.tar.gz

defines a function nls_string which allows collation to be set at
runtime:

select * from table order by nls_string(name, 'en_US.UTF-8')
select * from table order by nls_string(name, 'cs_CZ.UTF-8')
select * from table order by nls_string(name, 'C')

The README and INSTALL files with more details are included in the
distribution.

I'd appreciate comments about the viability of the goal, name,
and / or solution presented.

Yours,

--
------------------------------------------------------------------------
Honza Pazdziora | adelton(at)fi(dot)muni(dot)cz | http://www.fi.muni.cz/~adelton/
.project: Perl, mod_perl, DBI, Oracle, large Web systems, XML/XSL, ...
Only self-confident people can be simple.

Browse pgsql-hackers by date

  From Date Subject
Next Message Gavin Sherry 2004-02-26 10:07:49 Tablespaces
Previous Message Jonathan Scott 2004-02-26 07:47:52 Check Constraints and pg_dump