Issue Details (XML | Word | Printable)

Key: DERBY-2386
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Mayuresh Nirhali
Reporter: Don Smith
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

timestampdiff function fails when using SQL_TSI_FRAC_SECOND for datepart parameter, except for very small intervals

Created: 01/Mar/07 05:21 PM   Updated: 30/Jun/09 04:12 PM
Return to search
Component/s: SQL
Affects Version/s: 10.2.2.0
Fix Version/s: 10.3.1.4

Time Tracking:
Not Specified

File Attachments:
  Size
File derby2386-v2.diff 2007-03-15 09:44 AM Mayuresh Nirhali 2 kB
File derby2386.diff 2007-03-08 03:44 PM Mayuresh Nirhali 2 kB
HTML File Licensed for inclusion in ASF works releaseNote.html 2007-07-07 03:30 AM Myrna van Lunteren 4 kB
HTML File Licensed for inclusion in ASF works releaseNote.html 2007-05-26 08:38 PM Myrna van Lunteren 4 kB
HTML File Licensed for inclusion in ASF works releaseNote.html 2007-05-26 06:54 PM Myrna van Lunteren 4 kB
Environment: SUSE Linux Enterprise Desktop 10

Urgency: Normal
Issue & fix info: Release Note Needed
Resolution Date: 07/Jul/07 03:29 AM


 Description  « Hide
Using the timestampdiff function produces and integer overflow except for very small intervals. Error message is:

[Error Code: -1, SQL State: 22003] The resulting value is outside the range for the data type INTEGER.

I inserted the following row into my test table:

insert into datetest (ID,
startdate,
enddate) values (
5,
'2006-11-20 04:20:00.0',
'2006-11-20 04:20:00.2');

This test row works:

select {fn timestampdiff(SQL_TSI_FRAC_SECOND, startdate, enddate)} as diff from datetest where id = 5

DIFF
200000000

The value also looks too large, which could be exacerbating the problem.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #525549 Wed Apr 04 16:13:43 UTC 2007 djd DERBY-2386 Change {fn timestampdiff} to return a BIGINT.
Contributed by Mayuresh Nirhali Mayuresh.Nirhali@Sun.COM
Files Changed
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTimestamp.java