pgsql: Fix extract epoch from interval calculation

Started by Peter Eisentrautabout 4 years ago1 messagescomitters
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

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@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: /messages/by-id/CAAvxfHd5n=13NYA2q_tUq=3=SuWU-CufmTf-Ozj=frEgt7pXwQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f2a2bf66c87e14f07aefe23cbbe2f2d9edcd9734

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