Error when adding milliseconds to timestamps

230 views
Skip to first unread message

Lukas Eder

unread,
Mar 17, 2015, 10:20:13 AM3/17/15
to h2-da...@googlegroups.com
According to the doc, DATEADD() takes an int for the number of minutes/seconds/milliseconds/etc to be added to a timestamp:

This blows up quite quickly when using milliseconds, of course. Here a case where I'm subtracting 30 days:

select * 
from (select timestamp '2001-01-10 12:15:30.0' ts)
where dateadd('ms', -2592000000, ts) <= current_timestamp()

Now, obviously, I could use a different time unit, but I still think that it would be sensible to accept longs if milliseconds are accepted.

The issue was also reported on Stack Overflow by a jOOQ user:

Cheers,
Lukas

Noel Grandin

unread,
Mar 18, 2015, 4:21:11 AM3/18/15
to h2-da...@googlegroups.com
Thanks for reporting this, fixed in trunk.

Lukas Eder

unread,
Mar 18, 2015, 4:47:19 AM3/18/15
to h2-da...@googlegroups.com
That was quick, thank you very much!

2015-03-18 9:21 GMT+01:00 Noel Grandin <noelg...@gmail.com>:
Thanks for reporting this, fixed in trunk.


--
You received this message because you are subscribed to a topic in the Google Groups "H2 Database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/h2-database/GcletZDXTss/unsubscribe.
To unsubscribe from this group and all its topics, send an email to h2-database+unsubscribe@googlegroups.com.
To post to this group, send email to h2-da...@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages