pgsql: Detect overflow in timestamp[tz] subtraction. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Detect overflow in timestamp[tz] subtraction.
Date
Msg-id E1pUEcD-0029lO-NP@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix parsing of ISO-8601 interval fields with exponential notatio
Next
From: John Naylor
Date:
Subject: Re: pgsql: Add assert checking to pg_leftmost_one_pos32() and friends