Re: Multilingual application, ORDER BY w/ different locales?

Stephan Szabo <sszabo@megazone23.bigpanda.com>

From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Palle Girgensohn <girgen@partitur.se>, <pgsql-hackers@postgresql.org>
Date: 2001-11-17T21:13:15Z
Lists: pgsql-hackers
On Sat, 17 Nov 2001, Tom Lane wrote:

> Palle Girgensohn <girgen@partitur.se> writes:
> > My need is really to get different sorting on *the same* column, depending
> > on which locale the present user prefers.
> > ... I guess this is not even supported by the SQL standard, or
> > any other RDBMS for that matter, right?
>
> I believe SQL regards the locale as essentially a property of a
> datatype, which means that in theory you should be able to cast a column
> value to type text-with-locale-X and then ORDER BY that.  It'd be an
> on-the-fly sort, not able to exploit any indexes, but it sounds like
> that's acceptable to you.

Would it be possible to make a function in plpgsql or whatever that
wrapped the collate changes and then order by that and make functional
indexes?  Would the system use it?