Обсуждение: pgsql: Detect overflow in timestamp[tz] subtraction.

Поиск
Список
Период
Сортировка

pgsql: Detect overflow in timestamp[tz] subtraction.

От
Tom Lane
Дата:
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(-)