postgresql/src
Tom Lane 3dfef0c519 Avoid statically allocating gmtsub()'s timezone workspace.
localtime.c's "struct state" is a rather large object, ~23KB.  We were
statically allocating one for gmtsub() to use to represent the GMT
timezone, even though that function is not at all heavily used and is
never reached in most backends.  Let's malloc it on-demand, instead.

This does pose the question of how to handle a malloc failure, but
there's already a well-defined error report convention here, ie
set errno and return NULL.

We have but one caller of pg_gmtime in HEAD, and two in back branches,
neither of which were troubling to check for error.  Make them do so.
The possible errors are sufficiently unlikely (out-of-range timestamp,
and now malloc failure) that I think elog() is adequate.

Back-patch to all supported branches to keep our copies of the IANA
timezone code in sync.  This particular change is in a stanza that
already differs from upstream, so it's a wash for maintenance purposes
--- but only as long as we keep the branches the same.

Discussion: https://postgr.es/m/20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de
2018-10-16 11:50:18 -04:00
..
backend Avoid statically allocating gmtsub()'s timezone workspace. 2018-10-16 11:50:18 -04:00
bin pgbench: Report errors during run better 2018-10-15 10:34:35 +02:00
common Make spelling of "acknowledgment" consistent 2018-10-15 10:06:45 +02:00
fe_utils Fix lexing of standard multi-character operators in edge cases. 2018-08-23 21:42:40 +01:00
include Correct constness of a few variables. 2018-10-15 21:01:14 -07:00
interfaces Another round of portability hacking on ECPG regression tests. 2018-10-12 18:08:47 -04:00
makefiles Refactor installation of extension headers. 2018-09-07 14:19:14 +01:00
pl Fix omissions in snprintf.c's coverage of standard *printf functions. 2018-10-08 19:15:55 -04:00
port Make float exponent output on Windows look the same as elsewhere. 2018-10-12 11:14:27 -04:00
template Make some fixes to allow building Postgres on macOS 10.14 ("Mojave"). 2018-09-25 13:23:29 -04:00
test Make some subquery-using test cases a bit more robust. 2018-10-14 14:02:59 -04:00
timezone Avoid statically allocating gmtsub()'s timezone workspace. 2018-10-16 11:50:18 -04:00
tools Remove timetravel extension. 2018-10-11 11:43:56 -07:00
tutorial Deduplicate "invalid input syntax" messages for various types. 2018-07-22 14:58:01 -07:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Fix partial-build problems introduced by having more generated headers. 2018-04-09 16:42:10 -04:00
Makefile.global.in Build src/common files as a library with -fPIC. 2018-09-28 14:28:19 -04:00
Makefile.shlib Don't build static libraries on Cygwin 2018-10-02 16:46:57 -04:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00