aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/expandedrecord.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-10-16 11:50:18 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2018-10-16 11:50:18 -0400
commit3dfef0c519de40a196dc26b76604151347bf5454 (patch)
tree73946481bd0dee4a5293aed035c9258a7162e16b /src/backend/utils/adt/expandedrecord.c
parent62649bad831fb69b5d9644470acc413a35cddea6 (diff)
downloadpostgresql-3dfef0c519de40a196dc26b76604151347bf5454.tar.gz
postgresql-3dfef0c519de40a196dc26b76604151347bf5454.zip
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
Diffstat (limited to 'src/backend/utils/adt/expandedrecord.c')
0 files changed, 0 insertions, 0 deletions