postgresql/src
Tom Lane 8eb4a9312c Avoid thread-safety problem in ecpglib.
ecpglib attempts to force the LC_NUMERIC locale to "C" while reading
server output, to avoid problems with strtod() and related functions.
Historically it's just issued setlocale() calls to do that, but that
has major problems if we're in a threaded application.  setlocale()
itself is not required by POSIX to be thread-safe (and indeed is not,
on recent OpenBSD).  Moreover, its effects are process-wide, so that
we could cause unexpected results in other threads, or another thread
could change our setting.

On platforms having uselocale(), which is required by POSIX:2008,
we can avoid these problems by using uselocale() instead.  Windows
goes its own way as usual, but we can make it safe by using
_configthreadlocale().  Platforms having neither continue to use the
old code, but that should be pretty much nobody among current systems.

This should get back-patched, but let's see what the buildfarm
thinks of it first.

Michael Meskes and Tom Lane; thanks also to Takayuki Tsunakawa.

Discussion: https://postgr.es/m/31420.1547783697@sss.pgh.pa.us
2019-01-21 12:07:02 -05:00
..
backend Postpone generating tlists and EC members for inheritance dummy children. 2019-01-21 17:12:40 +09:00
bin Revert "Fix under-quoted filename pattern in pgbench TAP test." 2019-01-21 11:28:03 -05:00
common Use perfect hashing, instead of binary search, for keyword lookup. 2019-01-09 19:47:46 -05:00
fe_utils pgbench: add \cset and \gset commands 2019-01-10 13:42:20 -03:00
include Avoid thread-safety problem in ecpglib. 2019-01-21 12:07:02 -05:00
interfaces Avoid thread-safety problem in ecpglib. 2019-01-21 12:07:02 -05:00
makefiles Ensure link commands list *.o files before LDFLAGS. 2019-01-02 13:57:54 -05:00
pl Use perfect hashing, instead of binary search, for keyword lookup. 2019-01-09 19:47:46 -05:00
port Use our own getopt() on OpenBSD. 2019-01-18 15:06:26 -05:00
template Yet further rethinking of build changes for macOS Mojave. 2018-11-02 18:54:00 -04:00
test Allow COPY FROM to filter data using WHERE conditions 2019-01-20 00:22:14 +01:00
timezone Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00
tools Revert "Add valgrind suppressions for wcsrtombs optimizations" 2019-01-19 20:49:51 +01:00
tutorial Update copyright for 2019 2019-01-02 12:44:25 -05:00
.gitignore
DEVELOPERS
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in fix typo 2019-01-13 16:43:14 -05:00
Makefile.shlib Ensure static libraries have correct mod time even if ranlib messes it up. 2018-11-29 15:53:44 -05:00
nls-global.mk Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00