trinodb/trino
View on GitHubINTERVAL `x` SECOND values with `x` having >3 digits of decimal precision are silently truncated
Open
#6,754 opened on Jan 29, 2021
good first issue
Repository metrics
- Stars
- (9,113 stars)
- PR merge metrics
- (Avg merge 5d 9h) (306 merged PRs in 30d)
Description
minimal example:
presto:default>
SELECT val + INTERVAL '.0001' second
FROM (VALUES TIMESTAMP '2021-01-01 00:00:00.123456789 UTC')
AS t (val);
_col0
-----------------------------------
2021-01-01 00:00:00.123456789 UTC
(1 row)
This is a really unfortunate bug as it results in silently incorrect data. Ideally the INTERVAL function could be patched to do the right thing here, but we'd also be ok if it would at least throw an error rather than return incorrect data.