Vague idea for allowing per-column locale

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Vague idea for allowing per-column locale
Date: 2001-08-09 22:38:24
Message-ID: Pine.LNX.4.30.0108100020320.11408-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

We have realized that allowing per-column locale would be difficult with
the existing C library interface, because setlocale() is a pretty
inefficient operation. But I think what we could allow, and what would be
fairly useful, is the choice between the plain C locale and one "real"
locale of choice (as determined by initdb) on a column or datum basis.

One possible way to implement this is to set or clear a bit somewhere in
the header of each text (char, varchar) type datum, depending on what you
want. Basically, this bit is going to be part of the atttypmod. Then the
comparison operators would use strcoll or strcmp, depending on the choice,
and similarly for other functions that are locale-aware.

Does anyone see a problem with this, aside from the fact that this breaks
the internal representation of the character types (which might have to
happen anyway if we ever want to do something in this direction)?

(If this is an acceptable plan then we could tie this in with the proposed
work of making the LIKE optimization work. We wouldn't have to make up
new ugly-named operators, we'd just have to do a bit of plain old type
casting.)

--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mikhail Terekhov 2001-08-09 22:42:23 Re: Re: WIN32 errno patch
Previous Message Mikhail Terekhov 2001-08-09 22:34:23 Re: Re: WIN32 errno patch