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

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Palle Girgensohn <girgen(at)partitur(dot)se>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Multilingual application, ORDER BY w/ different locales?
Date: 2001-11-18 01:04:29
Message-ID: 20011117162318.U32516-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Sat, 17 Nov 2001, Tom Lane wrote:

> Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> writes:
> > 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?
>
> IIRC, we were debating whether we should consider collation to be an
> attribute of the datatype (think typmod) or an attribute of individual
> values (think field added to values of textual types). In the former
> case, a function like this would only work if we allowed its result to
> be declared as having the right collate attribute. Which is not
> impossible, but we don't currently associate any typmod with function
> arguments or results, and so I'm not sure how painful it would be.
> With the field-in-data-value approach it's easy to see how it would
> work. But another byte or word per text value might be a high price
> to pay ...

True. Although I wonder how things like substring would work in the
model with typmods if the collation isn't attached in any fashion to
the return values since I think the substring collation is supposed
to be the same as the input string's, whereas for something like
convert it's a different collation based on a parameter. I wonder if
as a temporary thing, you could use a function that did something
similar to strxfrm as long as you only used that for sorting purposes.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-11-18 01:46:36 Re: Open items
Previous Message Tom Lane 2001-11-17 21:27:39 Re: Open items