Derby
  1. Derby
  2. DERBY-4772

Data truncation error with XPLAIN-functionality enabled

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.6.2.1, 10.7.1.1
    • Fix Version/s: 10.6.2.4, 10.7.1.1
    • Component/s: SQL
    • Labels:
      None
    • Issue & fix info:
      Release Note Needed
    • Bug behavior facts:
      Seen in production

      Description

      When running a modified version of lang.OrderByAndSortAvoidance I get the following error:

      java.sql.SQLDataException: A truncation error was encountered trying to shrink CHAR 'Thread[DRDAConnThread_3,5,derby.daemons]' to length 32.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:79)
      at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:256)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:391)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
      at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2269)
      at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1321)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1673)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(EmbedPreparedStatement.java:303)
      at org.apache.derby.impl.sql.execute.xplain.XPLAINSystemTableVisitor.addStmtDescriptorsToSystemCatalog(XPLAINSystemTableVisitor.java:390)
      at org.apache.derby.impl.sql.execute.xplain.XPLAINSystemTableVisitor.doXPLAIN(XPLAINSystemTableVisitor.java:317)
      at org.apache.derby.impl.sql.execute.NoPutResultSetImpl.close(NoPutResultSetImpl.java:179)
      at org.apache.derby.impl.sql.execute.SortResultSet.close(SortResultSet.java:467)
      at org.apache.derby.impl.jdbc.EmbedResultSet.close(EmbedResultSet.java:575)
      at org.apache.derby.impl.drda.DRDAResultSet.close(DRDAResultSet.java:338)
      at org.apache.derby.impl.drda.DRDAStatement.rsClose(DRDAStatement.java:995)
      at org.apache.derby.impl.drda.DRDAConnThread.doneData(DRDAConnThread.java:7446)
      at org.apache.derby.impl.drda.DRDAConnThread.writeFDODTA(DRDAConnThread.java:7026)
      at org.apache.derby.impl.drda.DRDAConnThread.writeQRYDTA(DRDAConnThread.java:6910)
      at org.apache.derby.impl.drda.DRDAConnThread.processCommands(DRDAConnThread.java:870)
      at org.apache.derby.impl.drda.DRDAConnThread.run(DRDAConnThread.java:294)
      Caused by: java.sql.SQLException: A truncation error was encountered trying to shrink CHAR 'Thread[DRDAConnThread_3,5,derby.daemons]' to length 32.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
      ... 20 more
      Caused by: ERROR 22001: A truncation error was encountered trying to shrink CHAR 'Thread[DRDAConnThread_3,5,derby.daemons]' to length 32.
      at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:343)
      at org.apache.derby.iapi.types.SQLChar.hasNonBlankChars(SQLChar.java:1767)
      at org.apache.derby.iapi.types.SQLChar.normalize(SQLChar.java:1743)
      at org.apache.derby.iapi.types.SQLChar.normalize(SQLChar.java:1695)
      at org.apache.derby.iapi.types.DataTypeDescriptor.normalize(DataTypeDescriptor.java:648)
      at org.apache.derby.impl.sql.execute.NormalizeResultSet.normalizeColumn(NormalizeResultSet.java:329)
      at org.apache.derby.impl.sql.execute.NormalizeResultSet.normalizeRow(NormalizeResultSet.java:373)
      at org.apache.derby.impl.sql.execute.NormalizeResultSet.getNextRowCore(NormalizeResultSet.java:188)
      at org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(DMLWriteResultSet.java:127)
      at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:504)
      at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:436)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:317)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1232)
      ... 14 more

      I suspect the error can be triggered easily in client/server, but for convenience I'll attach the patch for the test where I see the issue.

      1. derby-4772-1a-increase_max_len.diff
        2 kB
        Kristian Waagan
      2. derby-4772-1b-increase_max_len.diff
        8 kB
        Kristian Waagan
      3. releaseNote.html
        4 kB
        Kristian Waagan
      4. releaseNote.html
        4 kB
        Kristian Waagan

        Issue Links

          Activity

          Gavin made changes -
          Workflow jira [ 12517945 ] Default workflow, editable Closed status [ 12800482 ]
          Kristian Waagan made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Rick Hillegas made changes -
          Affects Version/s 10.7.1.1 [ 12315564 ]
          Affects Version/s 10.7.1.0 [ 12314971 ]
          Fix Version/s 10.7.1.1 [ 12315564 ]
          Fix Version/s 10.7.1.0 [ 12314971 ]
          Kristian Waagan made changes -
          Link This issue is related to DERBY-4673 [ DERBY-4673 ]
          Kristian Waagan made changes -
          Link This issue incorporates DERBY-4673 [ DERBY-4673 ]
          Kristian Waagan made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 10.6.2.3 [ 12315434 ]
          Resolution Fixed [ 1 ]
          Kristian Waagan made changes -
          Attachment releaseNote.html [ 12459448 ]
          Kristian Waagan made changes -
          Attachment releaseNote.html [ 12459340 ]
          Kristian Waagan made changes -
          Fix Version/s 10.7.1.0 [ 12314971 ]
          Issue & fix info [Patch Available] [Release Note Needed]
          Kristian Waagan made changes -
          Attachment derby-4772-1b-increase_max_len.diff [ 12458639 ]
          Kristian Waagan made changes -
          Issue & fix info [Patch Available]
          Kristian Waagan made changes -
          Attachment derby-4771-1a-prototype_code_dump.stat [ 12452022 ]
          Kristian Waagan made changes -
          Attachment derby-4772-1a-increase_max_len.diff [ 12458617 ]
          Kristian Waagan made changes -
          Assignee Kristian Waagan [ kristwaa ]
          Knut Anders Hatlen made changes -
          Affects Version/s 10.6.2.1 [ 12315343 ]
          Affects Version/s 10.6.2.0 [ 12315342 ]
          Kathey Marsden made changes -
          Affects Version/s 10.6.2.0 [ 12315342 ]
          Affects Version/s 10.6.1.1 [ 12314973 ]
          Knut Anders Hatlen made changes -
          Link This issue is related to DERBY-4673 [ DERBY-4673 ]
          Brett Wooldridge made changes -
          Bug behavior facts [Seen in production]
          Affects Version/s 10.6.1.1 [ 12314973 ]
          Kristian Waagan made changes -
          Field Original Value New Value
          Attachment derby-4771-1a-prototype_code_dump.stat [ 12452022 ]
          Kristian Waagan created issue -

            People

            • Assignee:
              Kristian Waagan
              Reporter:
              Kristian Waagan
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development