db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4625) TIMESTAMP function doesn't accept nanoseconds
Date Thu, 02 Sep 2010 07:14:54 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12905434#action_12905434

Knut Anders Hatlen commented on DERBY-4625:

> I am wondering whether there are test cases which is addressed this
> setValue(..) function. If so since I did not find any regression
> failures regarding that, can't we conclude that the calculations of
> SQLChar are still correct?

It seems that the calculation in SQLChar changed, but in a way that
fixed DERBY-4626. So that's actually a good thing! :)

However, the change also makes the code in SQLChar a bit
confusing. Take for instance this fragment:

    int micros = 
        (theValue.getNanos() + SQLTimestamp.FRACTION_TO_NANO/2) / 

After the patch, the micros variable will actually hold the nanosecond
value, so we should change its name to nanos. Also, since the above
code now transforms nanoseconds to nanoseconds (that is, it doesn't do
anything), we should probably simplify it to:

    int nanos = theValue.getNanos();

> TIMESTAMP function doesn't accept nanoseconds
> ---------------------------------------------
>                 Key: DERBY-4625
>                 URL: https://issues.apache.org/jira/browse/DERBY-4625
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions:
>            Reporter: Knut Anders Hatlen
>            Assignee: C.S. Nirmal J. Fernando
>            Priority: Minor
>         Attachments: derby-4625-1.diff
> The TIMESTAMP function fails if the string argument specifies the number of nanoseconds.
It works if the argument is limited to microsecond resolution.
> ij> values timestamp('2010-04-21 12:00:00.123456');
> 1                         
> --------------------------
> 2010-04-21 12:00:00.123456
> 1 row selected
> ij> values timestamp('2010-04-21 12:00:00.123456789');
> ERROR 22008: '2010-04-21 12:00:00.123456789' is an invalid argument to the timestamp
> Since Derby (and JDBC) supports nanosecond resolution, the TIMESTAMP function should
also support it.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message