[odb-users] Changing global locale may lead to database connection error. PostgreSQL

Boris Kolpackov boris at codesynthesis.com
Fri Jul 17 07:19:58 EDT 2015


Hi Andrey,

Thanks for the detailed bug report, much appreciated. This locale
business is quite a can of warms. Here are some thoughs/notes:

1. Based on my experience, changing global locale to anything
   other than "C" is a sure way to end up in all kinds of trouble.
   See this email for some more information:
   
   http://codesynthesis.com/pipermail/xsd-users/2015-February/004526.html

2. Because of (1), I believe this is very seldom done and creating
   and setting "C" locale in every case where we use stringstream
   will be a performance drag that is unnecessary in 99.9% cases.

3. The proper way to fix this is to use C++11 to_string() and
   sto*() functions, which always use "C" locale. I've added
   an item to our TODO list to do just that once we drop C++98
   support (hint: yes, it is coming, and soon ;-)).

Boris



More information about the odb-users mailing list