Derby
  1. Derby
  2. DERBY-4106

The Reference Gulde claims that the INTEGER function can be applied to dates and times

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.4.2.0
    • Fix Version/s: 10.6.1.0
    • Component/s: Documentation
    • Labels:
      None
    • Environment:
      MS Windows XP Professional Version 2002 Service Pack 2, running NetBeans IDE 6.5
    • Urgency:
      Normal

      Description

      When Derby Reference Manual, version 10.4, explains the INTEGER function is said that:

      "The INTEGER function returns an integer representation of a number, character string,
      DATE, or time in the form of an integer constant"

      But when I try to convert a DATE to INTEGER I receive an sqlstate 42846: "Cannot convert types 'DATE' to 'INTEGER'."

      This is a sample query where the expected result is the integer number 1:

      select integer(date(1)) from SYSIBM.SYSDUMMY1

      1. docs.diff
        0.8 kB
        Bryan Pendleton
      2. rrefbuiltinteger.html
        4 kB
        Bryan Pendleton

        Issue Links

          Activity

          Hide
          Nelson Rodrigues added a comment -

          This problem may be related to DERBY-4107 issue.

          Show
          Nelson Rodrigues added a comment - This problem may be related to DERBY-4107 issue.
          Hide
          Rick Hillegas added a comment -

          Triaged July 2, 2009: Assigned normal urgency.

          Show
          Rick Hillegas added a comment - Triaged July 2, 2009: Assigned normal urgency.
          Hide
          Rick Hillegas added a comment -

          Changing this issue to a docs bug. The documentation says that the INTEGER function can be applied to dates and times. However, if you attempt to do this, you will get a casting error, at least as far back as 10.1.

          The documentation claims that INTEGER can be applied to numbers, strings, and date/times. The documentation then goes on to explain what you should expect to see if you apply INTEGER to numbers and strings. However, the documentation does not explain what should happen if you apply INTEGER to date/times.

          I believe that someone overzealously claimed that INTEGER can be applied to date/times and then didn't bother to verify what actually happens.

          If this is an important issue, then please file a separate enhancement request for applying INTEGER to date/time values. Please specify what behavior should be seen. For instance, should the INTEGER value of a DATE be the number of milliseconds or the number of days from the start of the UNIX epoch...or something else?

          Show
          Rick Hillegas added a comment - Changing this issue to a docs bug. The documentation says that the INTEGER function can be applied to dates and times. However, if you attempt to do this, you will get a casting error, at least as far back as 10.1. The documentation claims that INTEGER can be applied to numbers, strings, and date/times. The documentation then goes on to explain what you should expect to see if you apply INTEGER to numbers and strings. However, the documentation does not explain what should happen if you apply INTEGER to date/times. I believe that someone overzealously claimed that INTEGER can be applied to date/times and then didn't bother to verify what actually happens. If this is an important issue, then please file a separate enhancement request for applying INTEGER to date/time values. Please specify what behavior should be seen. For instance, should the INTEGER value of a DATE be the number of milliseconds or the number of days from the start of the UNIX epoch...or something else?
          Hide
          Bryan Pendleton added a comment -

          I removed the reference to date and time in the attached patch proposal.

          I checked the manual pages for SMALLINT and BIGINT and observed that
          they were correct, and made INTEGER follow their pattern.

          I checked that CastingTest.java in the lang suite already verifies
          the behavior of the INTEGER function, so no new tests are needed.

          This seems like a straightforward fix to the docs.

          Show
          Bryan Pendleton added a comment - I removed the reference to date and time in the attached patch proposal. I checked the manual pages for SMALLINT and BIGINT and observed that they were correct, and made INTEGER follow their pattern. I checked that CastingTest.java in the lang suite already verifies the behavior of the INTEGER function, so no new tests are needed. This seems like a straightforward fix to the docs.
          Hide
          Bryan Pendleton added a comment -

          Commited to the documentation trunk as revision 834300.

          Show
          Bryan Pendleton added a comment - Commited to the documentation trunk as revision 834300.
          Hide
          Dag H. Wanvik added a comment -

          Fix looks good to me! Thanks for fixing this, Bryan.

          Show
          Dag H. Wanvik added a comment - Fix looks good to me! Thanks for fixing this, Bryan.

            People

            • Assignee:
              Bryan Pendleton
              Reporter:
              Nelson Rodrigues
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development