Derby
  1. Derby
  2. DERBY-3856

difference between Embedded vs DerbyNetClient in format of return from timestamp(cast(? as varchar(32)))

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.3.3.1, 10.4.2.0, 10.5.1.1
    • Fix Version/s: 10.5.3.1, 10.6.2.1, 10.7.1.1
    • Component/s: SQL
    • Labels:
      None
    • Urgency:
      Normal
    • Bug behavior facts:
      Deviation from standard, Embedded/Client difference

      Description

      There is a slight difference in how Embedded vs. DerbyNetClient return a specific cast.
      This showed up during conversion of the test lang/datetime.sql which before was only run with Embedded...

      The following sql:
      prepare dateTimePS as 'values( date(cast(? as integer)),timestamp(cast(? as varchar(32))))';
      execute dateTimePS using 'values(cast(1 as integer), ''2003-03-05-17.05.43.111111'')';
      gives:
      1 |2
      -------------------------------------
      Embedded: 1970-01-01|2003-03-05-17.05.43.111111
      DerbyNetClient: 1970-01-01|2003-03-05 17:05:43.111111
      (in Embedded there's a '-' between date and time part, with DerbyNetClient a space; with Embedded the separator between time elements is ., with DerbyNetClient :. Embedded reflects the data as passed in, with DerbyNetClient it seems to be the default timestamp format).

      I am not sure which is correct at this point, but I confirmed the behavior is like this in latest builds of trunk and 10.3 and 10.4 branches.

      1. fix.diff
        5 kB
        Knut Anders Hatlen

        Issue Links

          Activity

          Myrna van Lunteren created issue -
          Myrna van Lunteren made changes -
          Field Original Value New Value
          Link This issue is part of DERBY-310 [ DERBY-310 ]
          Myrna van Lunteren made changes -
          Description There is a slight difference in how Embedded vs. DerbyNetClient return a specific cast.
          This showed up during conversion of the test lang/datetime.sql which before was only run with Embedded...

          The following sql:
          prepare dateTimePS as 'values( date(cast(? as integer)),timestamp(cast(? as varchar(32))))';
          execute dateTimePS using 'values(cast(1 as integer), ''2003-03-05-17.05.43.111111'')';
          gives:
                                         1 |2
                                         -------------------------------------
          Embedded: 1970-01-01|2003-03-05-17.05.43.111111
          DerbyNetClient: 1970-01-01|2003-03-05 17.05.43.111111
          (in Embedded there's a '-' between date and time part, with DerbyNetClient a space).

          I am not sure which is correct at this point, but I confirmed this is the same in latest builds of trunk and 10.3 and 10.4 branches.
          There is a slight difference in how Embedded vs. DerbyNetClient return a specific cast.
          This showed up during conversion of the test lang/datetime.sql which before was only run with Embedded...

          The following sql:
          prepare dateTimePS as 'values( date(cast(? as integer)),timestamp(cast(? as varchar(32))))';
          execute dateTimePS using 'values(cast(1 as integer), ''2003-03-05-17.05.43.111111'')';
          gives:
                                         1 |2
                                         -------------------------------------
          Embedded: 1970-01-01|2003-03-05-17.05.43.111111
          DerbyNetClient: 1970-01-01|2003-03-05 17.05.43.111111
          (in Embedded there's a '-' between date and time part, with DerbyNetClient a space).

          I am not sure which is correct at this point, but I confirmed the behavior is like this in latest builds of trunk and 10.3 and 10.4 branches.
          Myrna van Lunteren made changes -
          Description There is a slight difference in how Embedded vs. DerbyNetClient return a specific cast.
          This showed up during conversion of the test lang/datetime.sql which before was only run with Embedded...

          The following sql:
          prepare dateTimePS as 'values( date(cast(? as integer)),timestamp(cast(? as varchar(32))))';
          execute dateTimePS using 'values(cast(1 as integer), ''2003-03-05-17.05.43.111111'')';
          gives:
                                         1 |2
                                         -------------------------------------
          Embedded: 1970-01-01|2003-03-05-17.05.43.111111
          DerbyNetClient: 1970-01-01|2003-03-05 17.05.43.111111
          (in Embedded there's a '-' between date and time part, with DerbyNetClient a space).

          I am not sure which is correct at this point, but I confirmed the behavior is like this in latest builds of trunk and 10.3 and 10.4 branches.
          There is a slight difference in how Embedded vs. DerbyNetClient return a specific cast.
          This showed up during conversion of the test lang/datetime.sql which before was only run with Embedded...

          The following sql:
          prepare dateTimePS as 'values( date(cast(? as integer)),timestamp(cast(? as varchar(32))))';
          execute dateTimePS using 'values(cast(1 as integer), ''2003-03-05-17.05.43.111111'')';
          gives:
                                         1 |2
                                         -------------------------------------
          Embedded: 1970-01-01|2003-03-05-17.05.43.111111
          DerbyNetClient: 1970-01-01|2003-03-05 17:05:43.111111
          (in Embedded there's a '-' between date and time part, with DerbyNetClient a space; with Embedded the separator between time elements is ., with DerbyNetClient :. Embedded reflects the data as passed in, with DerbyNetClient it seems to be the default timestamp format).

          I am not sure which is correct at this point, but I confirmed the behavior is like this in latest builds of trunk and 10.3 and 10.4 branches.
          Dag H. Wanvik made changes -
          Comment [ And none of the timestamp outputs works for input which seems to need a period "." at that position... confusing. ]
          Dag H. Wanvik made changes -
          Comment [ The SQL standard has these productions:

          <timestamp literal> ::= TIMESTAMP <timestamp string>
          <timestamp string> ::= <quote> <unquoted timestamp string> <quote>
          <unquoted timestamp string> ::= <unquoted date string> <space> <unquoted time string>

          so DerbyNetClient seems the closest to the standard. Derby doesn't
          accept the TIMESTAMP literal either, of course,
          cf. http://wiki.apache.org/db-derby/SQLvsDerbyFeatures, but uses a
          built-in function. Still, it would be nice if the syntax for the
          <timestamp string> was compliant, or at least lenient to accept the
          standard form:

          ij> values timestamp('2003-03-05-17 05.43.111111');
          ERROR 22008: '2003-03-05-17 05.43.111111' is an invalid argument to the timestamp function.
          java.sql.SQLDataException: '2003-03-05-17 05.43.111111' is an invalid argument to the timestamp function.

          ij> values timestamp('2003-03-05-17.05.43.111111');
          1
          --------------------------
          2003-03-05 17:05:43.111111

          1 row selected


          ]
          Kathey Marsden made changes -
          Component/s SQL [ 11408 ]
          Myrna van Lunteren made changes -
          Affects Version/s 10.5.1.1 [ 12313771 ]
          Affects Version/s 10.5.0.0 [ 12313010 ]
          Kristian Waagan made changes -
          Bug behavior facts [Deviation from standard]
          Urgency Normal
          Knut Anders Hatlen made changes -
          Bug behavior facts [Deviation from standard] [Deviation from standard, Embedded/Client difference]
          Knut Anders Hatlen made changes -
          Assignee Knut Anders Hatlen [ knutanders ]
          Knut Anders Hatlen made changes -
          Attachment fix.diff [ 12446490 ]
          Knut Anders Hatlen made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Knut Anders Hatlen made changes -
          Issue & fix info [Patch Available]
          Knut Anders Hatlen made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Issue & fix info [Patch Available]
          Fix Version/s 10.7.0.0 [ 12314971 ]
          Resolution Fixed [ 1 ]
          Lily Wei made changes -
          Link This issue is required by DERBY-4728 [ DERBY-4728 ]
          Lily Wei made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Mike Matrigali made changes -
          Assignee Knut Anders Hatlen [ knutanders ] Mike Matrigali [ mikem ]
          Mike Matrigali made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Assignee Mike Matrigali [ mikem ] Knut Anders Hatlen [ knutanders ]
          Fix Version/s 10.5.3.1 [ 12314182 ]
          Fix Version/s 10.6.1.1 [ 12314973 ]
          Resolution Fixed [ 1 ]
          Kathey Marsden made changes -
          Fix Version/s 10.6.2.0 [ 12315342 ]
          Fix Version/s 10.6.1.1 [ 12314973 ]
          Knut Anders Hatlen made changes -
          Fix Version/s 10.6.2.1 [ 12315343 ]
          Fix Version/s 10.6.2.0 [ 12315342 ]
          Rick Hillegas made changes -
          Fix Version/s 10.7.1.1 [ 12315564 ]
          Fix Version/s 10.7.1.0 [ 12314971 ]
          Myrna van Lunteren made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Workflow jira [ 12440813 ] Default workflow, editable Closed status [ 12800022 ]

            People

            • Assignee:
              Knut Anders Hatlen
              Reporter:
              Myrna van Lunteren
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development