Fix overflow hazard in timestamp_pl_interval

From: Joseph Koshakow <koshy44(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Fix overflow hazard in timestamp_pl_interval
Date: 2024-04-28 02:59:44
Message-ID: CAAvxfHf77sRHKoEzUw9_cMYSpbpNS2C+J_+8Dq4+0oi8iKopeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

Attached is a patch that fixes some overflow/underflow hazards in
`timestamp_pl_interval`. The microseconds overflow could produce
incorrect result. The month overflow would generally still result in an
error from the timestamp month field being too low, but it's still
better to catch it early.

I couldn't find any existing timestamp plus interval tests so I stuck
a new tests in `timestamp.sql`. If there's a better place, then
please let me know.

Thanks,
Joe Koshakow

Attachment Content-Type Size
v1-0001-Catch-overflow-when-adding-timestamp-to-interval.patch text/x-patch 3.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joseph Koshakow 2024-04-28 03:19:52 Re: Fix overflow hazard in timestamp_pl_interval
Previous Message Andy Fan 2024-04-28 02:39:27 Re: a wrong index choose when statistics is out of date