Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-2964

ASSERT FAILED type of inserted column[0] = org.apache.derby.iapi.types.SQLVarchar type of template column[0] = org.apache.derby.iapi.types.CollatorSQLVarchar when inserting row into table that has been modified with unique constraint

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.4.1.3
    • Fix Version/s: 10.3.1.4, 10.4.1.3
    • Component/s: SQL
    • Labels:
      None

      Description

      Below is the test case from lang/modifyColumn.sql

      ij> connect 'jdbc:derby:nordb;create=true;territory=no_NO;collation=TERRITORY_BASED';
      ij(CONNECTION1)> create table t1 (vc varchar(1) not null, nvc varchar(1) not null, bv varchar(1) for bit data not null);

      alter table t1 add constraint uq unique (vc, nvc, bv);

      insert into t1 values ('p', 'p', x'01');
      insert into t1 values ('pe', 'p', x'01');
      alter table t1 alter vc set data type varchar(2);
      0 rows inserted/updated/deleted
      ij(CONNECTION1)> 0 rows inserted/updated/deleted
      ij(CONNECTION1)> 1 row inserted/updated/deleted
      ij(CONNECTION1)> ERROR 22001: A truncation error was encountered trying to shrink VARCHAR 'pe' to length 1.
      java.sql.SQLException: A truncation error was encountered trying to shrink VARCHAR 'pe' to length 1.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
      at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:202)
      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:1572)
      at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1293)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:596)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:528)
      at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:330)
      at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
      at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:364)
      at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:262)
      at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
      at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
      at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
      at org.apache.derby.tools.ij.main(ij.java:71)
      Caused by: ERROR 22001: A truncation error was encountered trying to shrink VARCHAR 'pe' to length 1.
      at org.apache.derby.iapi.error.StandardException.newException(StandardException.java:341)
      at org.apache.derby.iapi.types.SQLChar.hasNonBlankChars(SQLChar.java:1324)
      at org.apache.derby.iapi.types.SQLVarchar.normalize(SQLVarchar.java:173)
      at org.apache.derby.iapi.types.SQLVarchar.normalize(SQLVarchar.java:150)
      at org.apache.derby.iapi.types.DataTypeDescriptor.normalize(DataTypeDescriptor.java:505)
      at org.apache.derby.impl.sql.execute.NormalizeResultSet.normalizeRow(NormalizeResultSet.java:330)
      at org.apache.derby.impl.sql.execute.NormalizeResultSet.getNextRowCore(NormalizeResultSet.java:189)
      at org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(DMLWriteResultSet.java:125)
      at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:496)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:370)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1203)
      ... 10 more
      ij(CONNECTION1)> 0 rows inserted/updated/deleted
      ij(CONNECTION1)> insert into t1 values ('pe', 'p', x'01');
      ERROR XJ001: Java exception: 'ASSERT FAILED type of inserted column[0] = org.apache.derby.iapi.types.SQLVarchartype of t
      emplate column[0] = org.apache.derby.iapi.types.CollatorSQLVarchar: org.apache.derby.shared.common.sanity.AssertFailure'
      .
      java.sql.SQLException: Java exception: 'ASSERT FAILED type of inserted column[0] = org.apache.derby.iapi.types.SQLVarcha
      rtype of template column[0] = org.apache.derby.iapi.types.CollatorSQLVarchar: org.apache.derby.shared.common.sanity.Asse
      rtFailure'.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
      at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:88)
      at org.apache.derby.impl.jdbc.Util.javaException(Util.java:245)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
      at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
      at org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:1572)
      at org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1293)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:596)
      at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:528)
      at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:330)
      at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
      at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:364)
      at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:262)
      at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
      at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
      at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
      at org.apache.derby.tools.ij.main(ij.java:71)
      Caused by: org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED type of inserted column[0] = org.apache.de
      rby.iapi.types.SQLVarchartype of template column[0] = org.apache.derby.iapi.types.CollatorSQLVarchar
      at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:162)
      at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:147)
      at org.apache.derby.impl.store.access.btree.OpenBTree.isIndexableRowConsistent(OpenBTree.java:529)
      at org.apache.derby.impl.store.access.btree.BTreeController.doIns(BTreeController.java:385)
      at org.apache.derby.impl.store.access.btree.BTreeController.insert(BTreeController.java:1035)
      at org.apache.derby.impl.store.access.btree.index.B2IController.insert(B2IController.java:211)
      at org.apache.derby.impl.sql.execute.IndexChanger.insertAndCheckDups(IndexChanger.java:455)
      at org.apache.derby.impl.sql.execute.IndexChanger.doInsert(IndexChanger.java:398)
      at org.apache.derby.impl.sql.execute.IndexChanger.insert(IndexChanger.java:605)
      at org.apache.derby.impl.sql.execute.IndexSetChanger.insert(IndexSetChanger.java:268)
      at org.apache.derby.impl.sql.execute.RowChangerImpl.insertRow(RowChangerImpl.java:453)
      at org.apache.derby.impl.sql.execute.InsertResultSet.normalInsertCore(InsertResultSet.java:1024)
      at org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:497)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:370)
      at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1203)
      ... 10 more
      ij(CONNECTION1)>

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mamtas Mamta A. Satoor
                Reporter:
                kmarsden Katherine Marsden
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: