pgsql: Fix extract epoch from interval calculation

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix extract epoch from interval calculation
Date: 2022-04-19 19:12:01
Message-ID: E1ngtGb-0007ek-FS@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix extract epoch from interval calculation

The new numeric code for extract epoch from interval accidentally
truncated the DAYS_PER_YEAR value to an integer, leading to results
that mismatched the floating-point interval_part calculations.

The commit a2da77cdb4661826482ebf2ddba1f953bc74afe4 that introduced
this actually contains the regression test change that this reverts.
I suppose this was missed at the time.

Reported-by: Joseph Koshakow <koshy44(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://www.postgresql.org/message-id/flat/CAAvxfHd5n%3D13NYA2q_tUq%3D3%3DSuWU-CufmTf-Ozj%3DfrEgt7pXwQ%40mail.gmail.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7a8d8219ccbf0963f2171ea23e1616ee6a7823ba

Modified Files
--------------
src/backend/utils/adt/timestamp.c | 14 ++++++++++----
src/test/regress/expected/interval.out | 4 ++--
2 files changed, 12 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2022-04-20 02:05:54 pgsql: Remove duplicated word in comment of basebackup.c
Previous Message Bruce Momjian 2022-04-19 19:09:30 Re: pgsql: Fix some trailing whitespace in documentation files