[ 
https://issues.apache.org/jira/browse/DERBY-3764?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kathey Marsden updated DERBY-3764:
----------------------------------

          Derby Info: [Regression]
    Derby Categories: [High Value Fix]

I verified on trunk using the script to create the table and import data.
Here is the debug stack trace. The latest on the 10.2 looks ok. The problem 
seems to start with 10.3.  Marking as a regression.

ij> select 0 vlr_proc_anterior
             , 0 vlr_proc_atual
             , sum(vlr_contabil + vlr_ajuste) disp_financeira
             from contas_remessa rec
             where cd_tipo = 1105 and cd_conta = 4
             group by rec.cd_conta, rec.ds_conta
             union
             select case when cd_tipo = 170 then sum(vlr_contabil) + 
sum(vlr_ajuste) else 0 end vlr_proc_anterior
                  , case when cd_tipo = 175 then sum(vlr_contabil) + 
sum(vlr_ajuste) else 0 end vlr_proc_atual
                  , 0 disp_financeira
                  from contas_remessa where cd_tipo in (170, 175) and status = 
'S'
                  group by cd_tipo ;
ERROR XJ001: Java exception: 'Array index out of range: 4: 
java.lang.ArrayIndexOutOfBoundsException'.
java.sql.SQLException: Java exception: 'Array index out of range: 4: 
java.lang.ArrayIndexOutOfBoundsException'.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87)
        at org.apache.derby.impl.jdbc.Util.javaException(Util.java:244)
        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:2183)
        at 
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:614)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:555)
        at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:329)
        at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:508)
        at 
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:350)
        at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:248)
        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.Main.main(Main.java:73)
        at org.apache.derby.tools.ij.main(ij.java:59)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 4
        at java.util.Vector.elementAt(Vector.java:266)
        at 
org.apache.derby.impl.sql.compile.QueryTreeNodeVector.elementAt(QueryTreeNodeVector.java:51)
        at 
org.apache.derby.impl.sql.compile.ResultColumnList.setUnionResultExpression(ResultColumnList.java:2242)
        at 
org.apache.derby.impl.sql.compile.SetOperatorNode.buildRCL(SetOperatorNode.java:631)
        at 
org.apache.derby.impl.sql.compile.SetOperatorNode.bindResultColumns(SetOperatorNode.java:558)
        at 
org.apache.derby.impl.sql.compile.CursorNode.bindStatement(CursorNode.java:239)
        at 
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:314)
        at 
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
        at 
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConne
ctionContext.java:794)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:606)
        ... 9 more
ij>

> Union Query fail on Derby 10.4.1.3
> ----------------------------------
>
>                 Key: DERBY-3764
>                 URL: https://issues.apache.org/jira/browse/DERBY-3764
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.1.4, 10.4.1.3
>         Environment: Windows XP SP2, NetBeans 6.1 (IDE), Pentium 2 Core 512 
> Ram, Java 1.6.0_05
>            Reporter: Heleno da Silva Alves
>         Attachments: CONSTAS_REMESSA.sql, database_test.10.0.zip, 
> database_test.10.3.zip, database_test.10.4.zip, export_contas_remessas.exp
>
>
>     Running a Query on Derby 10.4.1.3 and 10.3.1.4 I got this error message: 
> Error code 0, SQL state XJ001: Java Exception: '4 >= 4: 
> java.lang.ArrayIndexOutOfBoundsException'.
>     After throw this exception the database shutdown and lost the connection.
>     I'm updating an application from a previous version of Derby 
> (Bundle-Version: 10.0.2000001 From derby.jar Manifest) so this query works 
> fine in version 10.0.
> The Query:
> select 0 vlr_proc_anterior
>              , 0 vlr_proc_atual
>              , sum(vlr_contabil + vlr_ajuste) disp_financeira    
>              from contas_remessa rec
>              where cd_tipo = 1105 and cd_conta = 4
>              group by rec.cd_conta, rec.ds_conta
>              union
>              select case when cd_tipo = 170 then sum(vlr_contabil) + 
> sum(vlr_ajuste) else 0 end vlr_proc_anterior
>                   , case when cd_tipo = 175 then sum(vlr_contabil) + 
> sum(vlr_ajuste) else 0 end vlr_proc_atual
>                   , 0 disp_financeira
>                   from contas_remessa where cd_tipo in (170, 175) and status 
> = 'S'                       
>                   group by cd_tipo
> The deby log entry:
> ----------------------------------------------------------------
> 2008-07-07 14:44:51.282 GMT:
>  Booting Derby version The Apache Software Foundation - Apache Derby - 
> 10.3.1.4 - (561794): instance c013800d-011a-fdfb-6fa4-00003451d386
> on database directory C:\PAD\database  
> Database Class Loader started - derby.database.classpath=''
> 2008-07-07 14:46:40.506 GMT Thread[SQLExecution,1,system] (XID = 3441038), 
> (SESSIONID = 0), (DATABASE = C:\PAD\database), (DRDAID = null), Cleanup 
> action starting
> 2008-07-07 14:46:40.506 GMT Thread[SQLExecution,1,system] (XID = 3441038), 
> (SESSIONID = 0), (DATABASE = C:\PAD\database), (DRDAID = null), Failed 
> Statement is: select 0 vlr_proc_anterior
>              , 0 vlr_proc_atual
>              , sum(vlr_contabil + vlr_ajuste) disp_financeira    
>              from contas_remessa rec
>              where cd_tipo = 1105 and cd_conta = 4
>              group by rec.cd_conta, rec.ds_conta
>              union
>              select case when cd_tipo = 170 then sum(vlr_contabil) + 
> sum(vlr_ajuste) else 0 end vlr_proc_anterior
>                   , case when cd_tipo = 175 then sum(vlr_contabil) + 
> sum(vlr_ajuste) else 0 end vlr_proc_atual
>                   , 0 disp_financeira
>                   from contas_remessa where cd_tipo in (170, 175) and status 
> = 'S'                       
>                   group by cd_tipo
> java.lang.ArrayIndexOutOfBoundsException: 4 >= 4
>       at java.util.Vector.elementAt(Vector.java:427)
>       at 
> org.apache.derby.impl.sql.compile.QueryTreeNodeVector.elementAt(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.compile.ResultColumnList.setUnionResultExpression(Unknown
>  Source)
>       at org.apache.derby.impl.sql.compile.SetOperatorNode.buildRCL(Unknown 
> Source)
>       at 
> org.apache.derby.impl.sql.compile.SetOperatorNode.bindResultColumns(Unknown 
> Source)
>       at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(Unknown 
> Source)
>       at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
>       at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
>       at 
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown
>  Source)
>       at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>       at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source)
>       at 
> org.netbeans.modules.db.sql.execute.SQLExecuteHelper.execute(SQLExecuteHelper.java:114)
>       at 
> org.netbeans.modules.db.sql.loader.SQLEditorSupport$SQLExecutor.run(SQLEditorSupport.java:479)
>       at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:561)
>       at 
> org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:986)
> Cleanup action completed

-- 
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