pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Detect overflow in timestamp[tz] subtraction.
Date: Mon, 20 Feb 2023 22:26:34 +0000
Message-ID: <E1pUEcD-0029lO-NP@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1pUEcD-0029lO-NP@gemulon.postgresql.org>
Permalink:  ../E1pUEcD-0029lO-NP@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pUEcD-0029lO-NP@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Detect overflow in timestamp[tz] subtraction.
  In-Reply-To: <E1pUEcD-0029lO-NP@gemulon.postgresql.org>
  References: <E1pUEcD-0029lO-NP@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox