[ http://issues.apache.org/jira/browse/DERBY-2015?page=comments#action_12449531 ] Bryan Pendleton commented on DERBY-2015: ----------------------------------------
I think this is a duplicate of DERBY-1089. Christian, can you try the patch attached to DERBY-1089 and see if it resolves the problem for you? > NullPointerException in INSERT ... SELECT with self-joined table and IDENTITY > column > ------------------------------------------------------------------------------------ > > Key: DERBY-2015 > URL: http://issues.apache.org/jira/browse/DERBY-2015 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.2.1.6 > Environment: Java 1.5.0_06-b05 WinXP > Reporter: Christian d'Heureuse > > 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. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
