db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-4107) The Reference Guide incorrectly describes the behavior of the DATE function when applied to an integer argument
Date Sun, 08 Nov 2009 20:23:32 GMT

     [ https://issues.apache.org/jira/browse/DERBY-4107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Bryan Pendleton updated DERBY-4107:

    Attachment: rrefdatefunc.html

I checked and I see that test_DateAndDatetimeFunctionsMore in the DateTimeTest
in the lang suite has tests for the DATE function which concur with Rick's analysis,
so I've constructed a patch proposal to the DATE reference page in the manual which
corrects the description to read 1970, not 0001, for the year.

I also added an example to the page, to hopefully make it more clear.

> The Reference Guide incorrectly describes the behavior of the DATE function when applied
to an integer argument
> ---------------------------------------------------------------------------------------------------------------
>                 Key: DERBY-4107
>                 URL: https://issues.apache.org/jira/browse/DERBY-4107
>             Project: Derby
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions:
>         Environment: MS Windows XP Professional Version 2002 Service Pack 2, running
NetBeans IDE 6.5
>            Reporter: Nelson Rodrigues
>            Assignee: Bryan Pendleton
>         Attachments: docs.diff, rrefdatefunc.html
> When Derby Reference Manual, version 10.4, lists Derby limitations for DATE is said that
the smallest DATE value is 0001-01-01 and the largest DATE value is 9999-12-31.
> When the same manual explains the DATE function is said that:
> "The argument must be ... a positive number less than or equal to 2,932,897 ... The result
is the date that is n-1 days after January 1, 0001, where n is the integral part of the number."
> Testing for the largest integer returns the expected result:
> select date(2932897) from SYSIBM.SYSDUMMY1   returns 9999-12-31 -> OK
> The problem comes when testing the smallest integer. We get a result different than we
> select date(1) from SYSIBM.SYSDUMMY1   returns 1970-01-01, but it should have returned
> The smallest date we get using integer as an argument to date function should be the
same we get when using the smallest string representation as an argument. In other words date(1)
should be equal to date('0001-01-01'). 
> select date('0001-01-01') from SYSIBM.SYSDUMMY1  returns 0001-01-01 -> OK

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

View raw message