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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Palle Girgensohn <girgen(at)partitur(dot)se>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Multilingual application, ORDER BY w/ different locales?
Date: 2001-11-17 18:39:36
Message-ID: 22114.1006022376@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Palle Girgensohn <girgen(at)partitur(dot)se> writes:
> I am dreaming of a SET LC_COLLATE or simliar command that will
> only affect my session, not all other users.
> I know this is not implemented in postgres. How impossible is it to add
> this feature, and what implications would pg suffer?

Actually, what the SQL spec suggests is that LOCALE be attached to
individual table columns. A SET command to cause LOCALE to change
on the fly within a session is quite impractical: that would mean
that the sort ordering of existing columns changes, which would mean
that any indexes on those columns are broken.

Per-column LOCALE is on the to-do list. In my mind the main difficulty
with it is that the standard C library doesn't really support concurrent
use of multiple locales: it's built around the assumption that you set
your locale once at program startup. setlocale() is, typically, not
a fast operation. To get around this it seems we'd need to write our
own set of locale library routines, which is a daunting amount of work.

I think the last time this came up, someone mentioned that there's an
open BSD-license locale library being worked on, which possibly we could
adapt instead of reinventing this wheel for ourselves. But I don't
recall more than that. Check the archives.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-11-17 18:46:11 Re: OCTET_LENGTH is wrong
Previous Message Bruce Momjian 2001-11-17 18:19:33 beta3