Hello everyone,
While trying the new Derby release (10.6.1.0), I ran into the following
error using XPLAIN style tables:
ERROR 22001: A truncation error was encountered trying to shrink CHAR
'C0A80265.A193-436003464463927241{25}' to length 32.
(Full stack trace is at the end of this message)
The culprit seems to be that the table SYSXPLAIN_STATEMENTS is created
with a column 'DRDA_ID CHAR(32)'.
After digging in the Derby code I found the following in
org.apache.derby.diag.ErrorLogReader
EmbedResultSetMetaData.getResultColumnDescriptor("DRDAID",
Types.VARCHAR, true, 50),
However, I also found the following in
org.apache.derby.impl.sql.catalog.XPLAINStatementDescriptor
SystemColumnImpl.getColumn("DRDA_ID", Types.CHAR, true, 32),
So I decided to manually create all the XPLAIN tables, but changed the
column DRDA_ID in SYSXPLAIN_STATEMENTS to a nullable VARCHAR(50) and the
problem seems to have vanished.
Can anyone confirm that this is a bug? If so, I'll open up a JIRA issue.
Thanks in advance.
Stephan van Loendersloot.
(Full stacktrace follows here)
2010-05-21 16:54:42.238 GMT Thread[DRDAConnThread_9,5,main] (XID =
56773), (SESSIONID = 32), (DATABASE = testdb), (DRDAID =
C0A80265.A193-436003464463927241{25}), Failed Statement is: insert into
"TESTDB"."SYSXPLAIN_STATEMENTS"(STMT_ID,STMT_NAME,STMT_TYPE,STMT_TEXT,JVM_ID,OS_IDENTIFIER,XPLAIN_MODE,XPLAIN_TIME,XPLAIN_THREAD_ID,TRANSACTION_ID,SESSION_ID,DATABASE_NAME,DRDA_ID,TIMING_ID)
values (?,?,?,?,?,?,?,?,?,?,?,?,?,?) with 14 parameters begin parameter
#1: 11a3c706-0128-bbb4-eeca-00001421734b :end parameter begin parameter
#2: SQL_CURLH000C9 :end parameter begin parameter #3: S :end parameter
begin parameter #4: SELECT day_parts.day_part_id, day_parts.name,
day_parts.standard, day_parts.publish, day_parts.rank FROM day_parts
WHERE (day_parts.publish = ?) ORDER BY day_parts.rank :end parameter
begin parameter #5: 7 :end parameter begin parameter #6: Linux :end
parameter begin parameter #7: F :end parameter begin parameter #8:
2010-05-21 18:54:42.23 :end parameter begin parameter #9:
Thread[DRDAConnThread_9,5,main] :end parameter begin parameter #10:
56773 :end parameter begin parameter #11: 32 :end parameter begin
parameter #12: testdb :end parameter begin parameter #13:
C0A80265.A193-436003464463927241{25} :end parameter begin parameter #14:
67e28705-0128-bbb4-eeca-00001421734b :end parameter
ERROR 22001: A truncation error was encountered trying to shrink CHAR
'C0A80265.A193-436003464463927241{25}' to length 32.
at
org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.iapi.types.SQLChar.hasNonBlankChars(Unknown Source)
at org.apache.derby.iapi.types.SQLChar.normalize(Unknown Source)
at org.apache.derby.iapi.types.SQLChar.normalize(Unknown Source)
at org.apache.derby.iapi.types.DataTypeDescriptor.normalize(Unknown
Source)
at
org.apache.derby.impl.sql.execute.NormalizeResultSet.normalizeColumn(Unknown
Source)
at
org.apache.derby.impl.sql.execute.NormalizeResultSet.normalizeRow(Unknown Source)
at
org.apache.derby.impl.sql.execute.NormalizeResultSet.getNextRowCore(Unknown
Source)
at
org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(Unknown
Source)
at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown
Source)
at
org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown
Source)
at
org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
at
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown
Source)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown
Source)
at
org.apache.derby.impl.sql.execute.xplain.XPLAINSystemTableVisitor.addStmtDescriptorsToSystemCatalog(Unknown
Source)
at
org.apache.derby.impl.sql.execute.xplain.XPLAINSystemTableVisitor.doXPLAIN(Unknown
Source)
at
org.apache.derby.impl.sql.execute.NoPutResultSetImpl.close(Unknown Source)
at org.apache.derby.impl.sql.execute.SortResultSet.close(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedResultSet.close(Unknown Source)
at org.apache.derby.impl.drda.DRDAResultSet.close(Unknown Source)
at org.apache.derby.impl.drda.DRDAStatement.rsClose(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.doneData(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.writeFDODTA(Unknown
Source)
at org.apache.derby.impl.drda.DRDAConnThread.writeQRYDTA(Unknown
Source)
at
org.apache.derby.impl.drda.DRDAConnThread.processCommands(Unknown Source)
at org.apache.derby.impl.drda.DRDAConnThread.run(Unknown Source)
Cleanup action completed