Re: a contrib function to query current locale values - Mailing list pgsql-hackers

From Tom Lane
Subject Re: a contrib function to query current locale values
Date
Msg-id 28185.981559008@sss.pgh.pa.us
Whole thread Raw
In response to Re: a contrib function to query current locale values  (Hannu Krosing <hannu@tm.ee>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: a contrib function to query current locale values
Next
From: Bruce Momjian
Date:
Subject: Re: Re: [GENERAL] MySQL -> Postgres dump converter