Re: a contrib function to query current locale values - Mailing list pgsql-hackers
From | Hannu Krosing |
---|---|
Subject | Re: a contrib function to query current locale values |
Date | |
Msg-id | 3A81BAAC.C413D1E@tm.ee Whole thread Raw |
In response to | Re: a contrib function to query current locale values (Karel Zak <zakkr@zf.jcu.cz>) |
List | pgsql-hackers |
Tom Lane wrote: > > Hannu Krosing <hannu@tm.ee> writes: > > BTW, does anyone know if setlocale() is an expensive function ? > > The variant where you're just querying the current setting should not be > too expensive. I'd expect the variant where you are changing the > setting to be very expensive, however; most likely, it goes out and > reads/parses the locale definition files. > > > I.e. would it be a huge performance hog if called before each and every > > compare of each and every VARCHAR() or TEXT field that has COLLATE defined. > > I do not think we will be able to get away with that in standard > implementations of the locale functions. We will need to roll our own > implementation that caches and reuses pre-loaded locale information for > multiple locales at once. > > Doesn't seem like an appetizing prospect, but I think there's no other > way to support per-column locales... > > regards, tom lane There seems to be a library released by IBM that we could use, see at: http://oss.software.ibm.com/developerworks/opensource/icu/project/ could someone review its license : http://oss.software.ibm.com/developer/opensource/license10.html for compatibility with postgres. At cursory reading it seems to have the same flaws that GPL : ---8<--------8<-------8<-------8<-------8<---- When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. ---8<--------8<-------8<-------8<-------8<---- i.e. forcing its own license. OTOH it 1) allows distribution in object-code form under other licenses 2) is in fact a library not a "Program" ;) 3) it claims commercial distribution to be ok. ---8<--------8<-------8<-------8<-------8<---- 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibilityalone. Under this section, the Commercial Contributor would have to defend claims against the other Contributorsrelated to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. ---8<--------8<-------8<-------8<-------8<---- -------- Hannu
pgsql-hackers by date: