Issue Details (XML | Word | Printable)

Key: DERBY-2015
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Unassigned
Reporter: Christian d'Heureuse
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Derby

NullPointerException in INSERT ... SELECT with self-joined table and IDENTITY column

Created: 28/Oct/06 09:36 PM   Updated: 13/Dec/07 09:05 AM
Return to search
Component/s: SQL
Affects Version/s: 10.2.1.6
Fix Version/s: None

Time Tracking:
Not Specified

Environment: Java 1.5.0_06-b05 WinXP
Issue Links:
Duplicate
 

Resolution Date: 23/Nov/06 05:36 PM


 Description  « Hide
The following statements generate a NullPointerException:

CREATE TABLE t1 (
   f1 INTEGER);

CREATE TABLE t2 (
   f2 INTEGER GENERATED ALWAYS AS IDENTITY,
   f3 INTEGER);

INSERT INTO t2 (f3)
   SELECT a.f1
      FROM t1 a
         INNER JOIN t1 b ON a.f1 = b.f1;

Stack trace:
----------------------------------------------------------------
2006-10-28 21:29:17.937 GMT:
 Booting Derby version The Apache Software Foundation - Apache Derby - 10.2.1.6 - (452058): instance c013800d-010e-90d3-9ea6-00000012fd20
on database directory C:\temp_sys\temp_Derby_TestErr_db

Database Class Loader started - derby.database.classpath=''
2006-10-28 21:29:25.437 GMT Thread[main,5,main] (XID = 125), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Cleanup action starting
2006-10-28 21:29:25.437 GMT Thread[main,5,main] (XID = 125), (SESSIONID = 0), (DATABASE = c:\temp_sys\temp_Derby_TestErr_db), (DRDAID = null), Failed Statement is: INSERT INTO t2 (f3)
   SELECT a.f1
      FROM t1 a
         INNER JOIN t1 b ON a.f1 = b.f1
java.lang.NullPointerException
        at org.apache.derby.impl.sql.compile.ResultColumnList.remapColumnReferencesToExpressions(Unknown Source)
        at org.apache.derby.impl.sql.compile.JoinNode.flatten(Unknown Source)
        at org.apache.derby.impl.sql.compile.FromList.flattenFromTables(Unknown Source)
        at org.apache.derby.impl.sql.compile.SelectNode.preprocess(Unknown Source)
        at org.apache.derby.impl.sql.compile.SingleChildResultSetNode.preprocess(Unknown Source)
        at org.apache.derby.impl.sql.compile.DMLStatementNode.optimize(Unknown Source)
        at org.apache.derby.impl.sql.compile.DMLModStatementNode.optimize(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.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
        at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
        at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
        at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
        at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
        at org.apache.derby.impl.tools.ij.Main14.main(Unknown Source)
        at org.apache.derby.tools.ij.main(Unknown Source)
Cleanup action completed
----------------------------------------------------------------

As with DERBY-1574, any subsequent SQL statements produce an internal error in the RawStore module.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
No work has yet been logged on this issue.