pgsql: Detect overflow in timestamp[tz] subtraction.

Started by Tom Laneover 3 years ago1 messagescomitters
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

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: /messages/by-id/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(-)