pgsql: Detect overflow in timestamp[tz] subtraction.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Detect overflow in timestamp[tz] subtraction.
Date: 2023-02-20 22:26:34
Message-ID: E1pUEcD-0029lO-NP@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Detect overflow in timestamp[tz] subtraction.

It's possible to overflow the int64 microseconds field of the
output interval when subtracting two timestamps. Detect that
instead of silently returning a bogus result.

Nick Babadzhanian

Discussion: https://postgr.es/m/CABw73Uq2oJ3E+kYvvDuY04EkhhkChim2e-PaghBDjOmgUAMWGw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8028e294b456bf1539649527fd98b3985fa4752a

Modified Files
--------------
src/backend/utils/adt/timestamp.c | 5 ++++-
src/test/regress/expected/timestamp.out | 9 +++++++++
src/test/regress/expected/timestamptz.out | 9 +++++++++
src/test/regress/sql/timestamp.sql | 4 ++++
src/test/regress/sql/timestamptz.sql | 4 ++++
5 files changed, 30 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message John Naylor 2023-02-21 04:59:03 Re: pgsql: Add assert checking to pg_leftmost_one_pos32() and friends
Previous Message Tom Lane 2023-02-20 21:56:07 pgsql: Fix parsing of ISO-8601 interval fields with exponential notatio