aboutsummaryrefslogtreecommitdiff
path: root/contrib/test_decoding/test_decoding.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2024-01-26 13:39:37 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2024-01-26 13:39:45 -0500
commit25cd2d64021ae081cbcef1592e0ee04ddda2e975 (patch)
treecc1ae50e139ce973074654e78f08fda055974fe4 /contrib/test_decoding/test_decoding.c
parent5ddf9973477729cf161b4ad0a1efd52f4fea9c88 (diff)
downloadpostgresql-25cd2d64021ae081cbcef1592e0ee04ddda2e975.tar.gz
postgresql-25cd2d64021ae081cbcef1592e0ee04ddda2e975.zip
Detect Julian-date overflow in timestamp[tz]_pl_interval.
We perform addition of the days field of an interval via arithmetic on the Julian-date representation of the timestamp's date. This step is subject to int32 overflow, and we also should not let the Julian date become very negative, for fear of weird results from j2date. (In the timestamptz case, allow a Julian date of -1 to pass, since it might convert back to zero after timezone rotation.) The additions of the months and microseconds fields could also overflow, of course. However, I believe we need no additional checks there; the existing range checks should catch such cases. The difficulty here is that j2date's magic modular arithmetic could produce something that looks like it's in-range. Per bug #18313 from Christian Maurer. This has been wrong for a long time, so back-patch to all supported branches. Discussion: https://postgr.es/m/18313-64d2c8952d81e84b@postgresql.org
Diffstat (limited to 'contrib/test_decoding/test_decoding.c')
0 files changed, 0 insertions, 0 deletions