postgresql/src/include
Tom Lane 6106f9dd71 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.

(Subsequent buildfarm results show that recent NetBSD versions still
lack uselocale(), but it's not a big problem because they also do not
support non-"C" settings for LC_NUMERIC.)

Back-patch of commits 8eb4a9312 and ee27584c4.

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

Discussion: https://postgr.es/m/31420.1547783697@sss.pgh.pa.us
2019-01-21 23:18:58 -05:00
..
access Restrict the use of temporary namespace in two-phase transactions 2019-01-18 09:21:58 +09:00
bootstrap Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
catalog Fix missing role dependencies for some schema and type ACLs. 2018-11-09 20:42:03 -05:00
commands Mark assorted variables PGDLLIMPORT. 2017-12-05 09:24:05 -05:00
common Increase SCRAM salt length 2017-08-24 14:08:23 -04:00
datatype Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
executor Fix failure with initplans used conditionally during EvalPlanQual rechecks. 2018-09-15 13:42:34 -04:00
fe_utils Empty search_path in Autovacuum and non-psql/pgbench clients. 2018-02-26 07:39:47 -08:00
foreign Separate reinitialization of shared parallel-scan state from ExecReScan. 2017-08-30 13:18:16 -04:00
lib Rename rbtree.c functions to use "rbt" prefix not "rb" prefix. 2018-11-06 13:25:24 -05:00
libpq Fix up references to scram-sha-256 2018-01-30 17:05:35 -05:00
mb Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
nodes Revise attribute handling code on partition creation 2018-11-08 16:22:09 -03:00
optimizer Avoid sharing PARAM_EXEC slots between different levels of NestLoop. 2019-01-11 15:54:09 -05:00
parser Fix INSERT ON CONFLICT UPDATE through a view that isn't just SELECT *. 2018-08-04 19:38:58 -04:00
port Remove overzeleous assertions in pg_atomic_flag code. 2018-04-07 18:30:15 -07:00
portability Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postmaster Log when a BRIN autosummarization request fails 2018-03-14 12:00:53 -03:00
regex Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
replication Add subtransaction handling for table synchronization workers. 2018-07-16 17:55:13 -04:00
rewrite Fix creation of resjunk tlist entries for inherited mixed UPDATE/DELETE. 2017-11-27 17:54:09 -05:00
snowball Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
statistics Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
storage PANIC on fsync() failure. 2018-11-19 13:40:57 +13:00
tcop Fix event triggers for partitioned tables 2018-10-06 19:17:46 -03:00
tsearch Fix serious performance problems in json(b) to_tsvector(). 2017-07-18 12:45:51 -04:00
utils Fix missing role dependencies for some schema and type ACLs. 2018-11-09 20:42:03 -05:00
.gitignore Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
c.h Allow btree comparison functions to return INT_MIN. 2018-10-05 16:01:29 -04:00
fmgr.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
funcapi.h Add a utility function to extract variadic function arguments 2017-10-25 07:14:21 -04:00
getaddrinfo.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
getopt_long.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
Makefile Add statistics subdirectory to Makefile. 2017-06-08 11:29:50 -04:00
miscadmin.h Backport: Mark assorted GUC variables as PGDLLIMPORT. 2018-02-22 12:54:45 -08:00
pg_config.h.in Avoid thread-safety problem in ecpglib. 2019-01-21 23:18:58 -05:00
pg_config.h.win32 Avoid thread-safety problem in ecpglib. 2019-01-21 23:18:58 -05:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.win32 Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Fix default minimum value for descending sequences 2017-01-23 14:00:58 -05:00
pg_getopt.h Use our own getopt() on OpenBSD. 2019-01-18 15:06:26 -05:00
pg_trace.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pgstat.h Fix replication origin-related race conditions 2017-08-08 16:07:46 -04:00
pgtar.h Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
pgtime.h Mark assorted variables PGDLLIMPORT. 2017-12-05 09:24:05 -05:00
port.h Improve detection of child-process SIGPIPE failures. 2018-12-16 14:32:14 -05:00
postgres.h Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
rusagestub.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
windowapi.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00