[ 
https://issues.apache.org/jira/browse/DERBY-3310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567206#action_12567206
 ] 

Kathey Marsden commented on DERBY-3310:
---------------------------------------

So things seem to work ok without the assert because SQLLongint.setValue()
calls getLong() on the value it is being set from so we get a compatible value.

protected void setFrom(DataValueDescriptor theValue) throws StandardException {

                setValue(theValue.getLong());
        }

Here is the trace where it is called.

Thread [main] (Suspended (breakpoint at line 94 in SQLInteger)) 
        SQLInteger.getLong() line: 94   
        SQLLongint.setFrom(DataValueDescriptor) line: 440       
        SQLLongint(DataType).setValue(DataValueDescriptor) line: 490    
        SQLLongint(DataType).normalize(DataTypeDescriptor, DataValueDescriptor) 
line: 662       
        DataTypeDescriptor.normalize(DataValueDescriptor, DataValueDescriptor) 
line: 469        
        NormalizeResultSet.normalizeRow(ExecRow) line: 330      
        NormalizeResultSet.getNextRowCore() line: 189   
        InsertResultSet(DMLWriteResultSet).getNextRowCore(NoPutResultSet) line: 
127     
        InsertResultSet.open() line: 496        
        GenericPreparedStatement.execute(Activation, boolean, long) line: 370   
        EmbedStatement40(EmbedStatement).executeStatement(Activation, boolean, 
boolean) line: 1203      
        EmbedStatement40(EmbedStatement).execute(String, boolean, boolean, int, 
int[], String[]) line: 596      
        EmbedStatement40(EmbedStatement).execute(String) line: 528      
        ij.executeImmediate(String) line: 330   
        utilMain14(utilMain).doCatch(String) line: 522  
        utilMain14(utilMain).runScriptGuts() line: 364  
        utilMain14(utilMain).go(LocalizedInput[], LocalizedOutput, Properties) 
line: 262        
        Main14(Main).go(LocalizedInput, LocalizedOutput, Properties) line: 215  
        Main.mainCore(String[], Main) line: 181 
        Main14.main(String[]) line: 56  
        ij.main(String[]) line: 71      

Is a cast still needed?


> ASSERT in MergeSort.checkColumnTypes() disallow legal type conversions
> ----------------------------------------------------------------------
>
>                 Key: DERBY-3310
>                 URL: https://issues.apache.org/jira/browse/DERBY-3310
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.4.0.0
>            Reporter: Dyre Tjeldvoll
>            Priority: Minor
>         Attachments: cast-repro.sql
>
>
> The following code 
> CREATE TABLE U (SNAME VARCHAR(32000), TNAME VARCHAR(32000), C1 BIGINT);
> -- This triggers an ASSERT (because 2 is INTEGER and not BIGINT)
> INSERT INTO U(SNAME, TNAME, C1) SELECT DISTINCT SCHEMANAME, TABLENAME, 2
>  FROM SYS.SYSTABLES T JOIN SYS.SYSSCHEMAS S ON T.SCHEMAID = S.SCHEMAID;
> gives
> ERROR XJ001: Java exception: 'ASSERT FAILED col1.getClass() (class 
> org.apache.derby.iapi.types.SQLInteger) expected to be the same as 
> col2.getClass() (class org.apache.derby.iapi.types.SQLLongint): 
> org.apache.derby.shared.common.sanity.AssertFailure'.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to