Re: BUG #18313: No error triggered when subtracting an interval from a timestamp
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: c.maurer@gmx.at
Cc: pgsql-bugs@lists.postgresql.org
Date: 2024-01-26T17:32:02Z
Lists: pgsql-bugs
Attachments
- catch-julian-date-overflow-in-interval-addition.patch (text/x-diff) patch
PG Bug reporting form <noreply@postgresql.org> writes: > The SQL script below uses an anchor date (2000-01-01) in a table and tries > to subtract an interval (in days) from it. > Considering the timestamp range, the maximum number of days that can be > successfully subtracted should be 2451545. All higher values are then > expected to trigger an exception. > However, when subtracting 2483590, no error is triggered. This is true up to > 2539738. > Subtracting 2539739 again shows an error message. > Is this the intended behavior? Nope. Looks like we need to check for an out-of-range Julian date when subtracting intervals from timestamps, more or less as attached. regards, tom lane
Commits
-
Detect Julian-date overflow in timestamp[tz]_pl_interval.
- 25cd2d64021a 17.0 landed
- c3bdb25fb5f6 12.18 landed
- 86b6243a8ea9 15.6 landed
- 7204aea835d0 16.2 landed
- 425127bed2e7 13.14 landed
- 3eb8a87f6e71 14.11 landed