postgresql/src/backend
Tom Lane 25cd2d6402 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
2024-01-26 13:39:45 -05:00
..
access Combine FSM updates for prune and no-prune cases. 2024-01-26 11:40:16 -05:00
archive Update copyright for 2024 2024-01-03 20:49:05 -05:00
backup Temporary patch to help debug pg_walsummary test failures. 2024-01-26 13:25:19 -05:00
bootstrap Make attstattarget nullable 2024-01-13 18:14:53 +01:00
catalog Reindex toast before its main relation in reindex_relation() 2024-01-26 17:39:58 +09:00
commands Split some code out from MergeAttributes() 2024-01-26 13:52:05 +01:00
executor Add soft error handling to some expression nodes 2024-01-24 15:04:33 +09:00
foreign Update copyright for 2024 2024-01-03 20:49:05 -05:00
jit jit: Require at least LLVM 10. 2024-01-25 15:42:34 +13:00
lib Fix broken Bitmapset optimization in DiscreteKnapsack() 2024-01-19 10:44:36 +13:00
libpq Update copyright for 2024 2024-01-03 20:49:05 -05:00
main Remove dummy_spinlock 2024-01-25 11:43:47 +01:00
nodes Add temporal PRIMARY KEY and UNIQUE constraints 2024-01-24 16:34:37 +01:00
optimizer De-dupicate Memoize cache keys 2024-01-26 20:51:36 +13:00
parser Add a const decoration 2024-01-25 13:34:49 +01:00
partitioning Update copyright for 2024 2024-01-03 20:49:05 -05:00
po Update copyright for 2024 2024-01-03 20:49:05 -05:00
port Close socket in case of errors in setting non-blocking 2024-01-17 11:24:11 +01:00
postmaster Remove redundant HandleWalWriterInterrupts(). 2024-01-25 12:50:08 +09:00
regex Update copyright for 2024 2024-01-03 20:49:05 -05:00
replication Allow to enable failover property for replication slots via SQL API. 2024-01-25 12:15:46 +05:30
rewrite Support identity columns in partitioned tables 2024-01-16 17:24:52 +01:00
snowball Add copyright notices to a few perl scripts that don't have them 2024-01-05 13:15:50 +00:00
statistics Update copyright for 2024 2024-01-03 20:49:05 -05:00
storage Make spelling of cancelled/cancellation consistent 2024-01-26 12:38:15 +01:00
tcop Error message capitalisation 2024-01-18 09:35:12 +01:00
tsearch Update copyright for 2024 2024-01-03 20:49:05 -05:00
utils Detect Julian-date overflow in timestamp[tz]_pl_interval. 2024-01-26 13:39:45 -05:00
.gitignore
common.mk
Makefile Cross-check lists of predefined LWLocks. 2024-01-09 11:05:19 -06:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
nls.mk