| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | c(dot)maurer(at)gmx(dot)at |
| Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BUG #18313: No error triggered when subtracting an interval from a timestamp |
| Date: | 2024-01-26 17:32:02 |
| Message-ID: | 927312.1706290322@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
PG Bug reporting form <noreply(at)postgresql(dot)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
| Attachment | Content-Type | Size |
|---|---|---|
| catch-julian-date-overflow-in-interval-addition.patch | text/x-diff | 2.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David G. Johnston | 2024-01-26 22:32:56 | Re: v17 Possible Union All Bug |
| Previous Message | Laurenz Albe | 2024-01-26 13:53:41 | Re: BUG #18295: In PostgreSQL a unique index on targeted columns is sufficient to support a foreign key |