Vague idea for allowing per-column locale - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Vague idea for allowing per-column locale
Date
Msg-id Pine.LNX.4.30.0108100020320.11408-100000@peter.localdomain
Whole thread Raw
Responses Re: Vague idea for allowing per-column locale
List 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@gmx.net   http://funkturm.homeip.net/~peter



pgsql-hackers by date:

Previous
From: Mikhail Terekhov
Date:
Subject: Re: Re: WIN32 errno patch
Next
From: Mikhail Terekhov
Date:
Subject: Re: Re: WIN32 errno patch