Fix extract epoch from interval calculation
authorPeter Eisentraut <peter@eisentraut.org>
Tue, 19 Apr 2022 18:38:53 +0000 (20:38 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Tue, 19 Apr 2022 19:04:52 +0000 (21:04 +0200)
commitf2a2bf66c87e14f07aefe23cbbe2f2d9edcd9734
tree8ee986db7380f57b38eee0d5d368caa0d2662d6e
parenta62bff74b135b191de0417d1cc8ec52f144c8fe7
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: https://www.postgresql.org/message-id/flat/CAAvxfHd5n%3D13NYA2q_tUq%3D3%3DSuWU-CufmTf-Ozj%3DfrEgt7pXwQ%40mail.gmail.com
src/backend/utils/adt/timestamp.c
src/test/regress/expected/interval.out