You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2009/10/23 15:04:59 UTC

[jira] Closed: (DERBY-4414) NullPointerException with JOIN...USING and invalid table name in select list

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

Knut Anders Hatlen closed DERBY-4414.
-------------------------------------

          Resolution: Fixed
       Fix Version/s: 10.6.0.0
    Issue & fix info: [Repro attached]  (was: [Repro attached, Patch Available])

Committed revision 829041.

> NullPointerException with JOIN...USING and invalid table name in select list
> ----------------------------------------------------------------------------
>
>                 Key: DERBY-4414
>                 URL: https://issues.apache.org/jira/browse/DERBY-4414
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.6.0.0
>
>         Attachments: derby-4414-1a.diff
>
>
> ij version 10.6
> ij> connect 'jdbc:derby:memory:db;create=true';
> ij> create table t(a int, b int, c int);
> 0 rows inserted/updated/deleted
> ij> select t.* from t t1 join t t2 using (a);
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
>         at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
>         at org.apache.derby.impl.jdbc.Util.javaException(Util.java:299)
>         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:2204)
>         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:521)
>         at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:363)
>         at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:261)
>         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: ': java.lang.NullPointerException'.
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:119)
>         at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         ... 16 more
> Caused by: java.lang.NullPointerException
>         at org.apache.derby.impl.sql.compile.JoinNode.getAllResultColumns(JoinNode.java:431)
>         at org.apache.derby.impl.sql.compile.FromList.expandAll(FromList.java:474)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.expandAllsAndNameColumns(ResultColumnList.java:1598)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.bindExpressions(ResultColumnList.java:686)
>         at org.apache.derby.impl.sql.compile.SelectNode.bindExpressions(SelectNode.java:451)
>         at org.apache.derby.impl.sql.compile.DMLStatementNode.bindExpressions(DMLStatementNode.java:227)
>         at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(DMLStatementNode.java:140)
>         at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(CursorNode.java:249)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:319)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:824)
>         at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:606)
>         ... 9 more
> The query is expected to fail (because the table name in t.* does not match any of the joined tables), but not with a NullPointerException. A similar query with ON instead of USING fails more gracefully:
> ij> select t.* from t t1 join t t2 on t1.a=t2.a;
> ERROR 42X10: 'T' is not an exposed table name in the scope in which it appears.

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