[
https://issues.apache.org/jira/browse/DERBY-6131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13615378#comment-13615378
]
Kathey Marsden commented on DERBY-6131:
---------------------------------------
I was able to reproduce the issue. Here is the full stack trace:
ij> select name from myView where upper(name) in ('AA', 'BB');
ERROR XJ001: Java exception:
'org.apache.derby.impl.sql.compile.SimpleStringOperatorNode incompatible with
org.apache.de
rby.impl.sql.compile.ColumnReference: java.lang.ClassCastException'.
java.sql.SQLException: Java exception:
'org.apache.derby.impl.sql.compile.SimpleStringOperatorNode incompatible with
org
.apache.derby.impl.sql.compile.ColumnReference: java.lang.ClassCastException'.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:98)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:148)
at org.apache.derby.impl.jdbc.Util.javaException(Util.java:305)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:436)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
at
org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2400)
at
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:85)
at
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:700)
at
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:640)
at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:367)
at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:527)
at
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:369)
at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:245)
at org.apache.derby.impl.tools.ij.Main.go(Main.java:229)
at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:184)
at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
at org.apache.derby.tools.ij.main(ij.java:59)
Caused by: java.sql.SQLException: Java exception:
'org.apache.derby.impl.sql.compile.SimpleStringOperatorNode incompatib
le with org.apache.derby.impl.sql.compile.ColumnReference:
java.lang.ClassCastException'.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:42)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:12
2)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
... 16 more
Caused by: java.lang.ClassCastException:
org.apache.derby.impl.sql.compile.SimpleStringOperatorNode incompatible with or
g.apache.derby.impl.sql.compile.ColumnReference
at
org.apache.derby.impl.sql.compile.PredicateList.pushExpressionsIntoSelect(PredicateList.java:1523)
at
org.apache.derby.impl.sql.compile.UnionNode.pushExpressions(UnionNode.java:354)
at
org.apache.derby.impl.sql.compile.ProjectRestrictNode.pushExpressions(ProjectRestrictNode.java:1135)
at
org.apache.derby.impl.sql.compile.FromList.pushPredicates(FromList.java:846)
at
org.apache.derby.impl.sql.compile.SelectNode.preprocess(SelectNode.java:1292)
at
org.apache.derby.impl.sql.compile.DMLStatementNode.optimizeStatement(DMLStatementNode.java:300)
at
org.apache.derby.impl.sql.compile.CursorNode.optimizeStatement(CursorNode.java:601)
at
org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:457)
at
org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:99)
at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConne
ctionContext.java:1103)
at
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:691)
... 9 more
> select from view with "upper" and "in" does not work
> ----------------------------------------------------
>
> Key: DERBY-6131
> URL: https://issues.apache.org/jira/browse/DERBY-6131
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.9.1.0, 10.8.3.0
> Environment: windows
> Reporter: Rong Qu
>
> the issue can be reproduced
> 1. create table myTbl1 (name varchar(1000));
> 2. create table myTbl2 (name varchar(1000));
> 3. create view myView (name) as select t1.name from myTbl1 t1 union all
> select t2.name from myTbl2 t2;
> 4. select name from myView where upper(name) in ('AA', 'BB');
> #4 failed with "org.apache.derby.impl.sql.compile.SimpleStringOperatorNode
> incompatible with org.apache.derby.impl.sql.compile.ColumnReference:
> java.lang.ClassCastException"
> If the view is created as "create myView (name) as select t1.name from myTbl1
> t1", the query worked fine.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira